#APL(NARS), 54 chars, 108 bytes {q←z×z←1.96⋄h←z×√(⍺×⍵÷n←⍺+⍵)+q÷4⋄(n+q)÷⍨(⍺+q÷2)+(-h)h} test: f←{q←z×z←1.96⋄h←z×√(⍺×⍵÷n←⍺+⍵)+q÷4⋄(n+q)÷⍨(⍺+q÷2)+(-h)h} 0 f 1 0 0.7934567085 25 f 75 0.17545094 0.3430464637 1 f 0 0.2065432915 1