Option Explicit
Sub Main()
Dim x, F
For x = 1 To 5
Norm x, F '½Õ¥Îpºâ±`ºA¤À§G¨ç¼Æªº°Æµ{¦¡
Debug.Print "±`ºA°¾Â÷ÂI x =", x, "¤U°¼·§²v F =", F
Next x
For x = -1 To -5 Step -1
Norm x, F '½Õ¥Îpºâ±`ºA¤À§G¨ç¼Æªº°Æµ{¦¡
Debug.Print "±`ºA°¾Â÷ÂI x =", x, "¤U°¼·§²v F =", F
Next x
End Sub
'pºâ±`ºA¤À§G¨ç¼Æ
'x¡G±`ºA°¾Â÷ÂI
'F¡G¤U°¼·§²v
Public Sub Norm(x, F)
Dim y As Double, ER As Double, Q As Double
Dim A
Const a1 As Double = 0.0705230784
Const a2 As Double = 0.0422820123
Const a3 As Double = 0.0092705272
Const a4 As Double = 0.0001520143
Const a5 As Double = 0.0002765672
Const a6 As Double = 0.0000430638
y = 0.707106781187 * Abs(x)
A = a4 + y * (a5 + y * a6)
A = a3 + y * A
A = a2 + y * A
A = a1 + y * A
ER = 1 - (1 + y * A) ^ (-16)
Q = 0.5 * ER
If x < 0 Then F = 0.5 - Q Else F = 0.5 + Q
End Sub |