Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Math/Math.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Math/Math.ab	(revision 587)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Math/Math.ab	(revision 589)
@@ -3,4 +3,103 @@
 Namespace ActiveBasic
 Namespace Math
+'----
+'浮動小数点数補助
+Function ldexp(x As Double, n As Long) As Double
+	If x = 0 Then
+		ldexp = 0
+		Exit Function
+	End If
+	Dim pSrc = VarPtr(x) As *QWord
+	Dim pDest = VarPtr(ldexp) As *QWord
+	n += (pSrc[0] >> 52) As DWord And &h7FF
+	pDest[0] = n << 52 Or (pSrc[0] And &h800FFFFFFFFFFFFF)
+End Function
+
+Function frexp(x As Double, ByRef n As Long) As Double
+	If x = 0 Then
+		n = 0
+		frexp = 0
+		Exit Function
+	End If
+
+	Dim pSrc = VarPtr(x) As *QWord
+	Dim pDest = VarPtr(frexp) As *QWord
+	n = ((pSrc[0] >> 52) As DWord And &h7FF) - 1022
+	pDest[0] = (pSrc[0] And &h800FFFFFFFFFFFFF) Or &h3FE0000000000000
+End Function
+
+Function frexp(x As Single, ByRef n As Long) As Single
+	If x = 0 Then
+		n = 0
+		frexp = 0
+		Exit Function
+	End If
+
+	Dim pSrc As *DWord, pDest As *DWord
+	pSrc = VarPtr(x) As *DWord
+	pDest = VarPtr(frexp) As *DWord
+	n = ((pSrc[0] >> 23) And &hFF) - 126
+	pDest[0] = (pSrc[0] And &h807FFFFF) Or &h7E000000
+End Function
+
+'----
+'冪乗
+Function pow(x As Double, n As Long) As Double
+	Dim abs_n As Long
+	Dim r = 1 As Double
+
+	abs_n=Abs(n) As Long
+	While abs_n<>0
+		If abs_n and 1 Then r *= x
+		x = x * x
+		abs_n >>= 1 ' abs_n \= 2
+	Wend
+
+	If n>=0 Then
+		pow=r
+	Else
+		pow=1/r
+	End If
+End Function
+
+Function pow(x As Double, y As Double) As Double
+	Dim yi = y As Long
+	If y = yi Then
+		pow = pow(x, yi)
+	ElseIf x>0 Then
+		pow = Exp(y * Log(x))
+		Exit Function
+	ElseIf x<>0 or y<=0 Then
+		pow = Detail.GetNaN()
+	Else
+		pow = 0
+	End If
+End Function
+
+Function Sqrt(x As Double) As Double
+	If x > 0 Then
+		If IsInf(x) Then
+			Sqrt = x
+		Else
+			Sqrt = x
+			Dim i = (VarPtr(Sqrt) + 6) As *Word
+			Dim jj = GetWord(i) As Long
+			Dim j = jj >> 5 As Long
+			Dim k = (jj And &h0000001f) As Long
+			j = (j + 511) << 4 + k
+			SetWord(i, j)
+			Dim last As Double
+			Do
+				last = Sqrt
+				Sqrt = (x / Sqrt + Sqrt) * 0.5
+			Loop While Sqrt <> last
+		End If
+	ElseIf x < 0 Then
+		Sqrt = Detail.GetNaN()
+	Else
+		'x = 0 Or NaN
+		Sqrt = x
+	End If
+End Function
 
 'xの符号だけをyのものにした値を返す。
@@ -15,4 +114,291 @@
 End Function
 
+'----
+'絶対値
+Function Abs(n As Double) As Double
+	If n < 0 Then
+		Abs = -n
+	Else
+		Abs = n
+	End If
+End Function
+
+Function Abs(n As Single) As Single
+	If n < 0 Then
+		Abs = -n
+	Else
+		Abs = n
+	End If
+End Function
+
+Function Abs(n As Int64) As Int64
+	If n < 0 Then
+		Abs = -n
+	Else
+		Abs = n
+	End If
+End Function
+
+Function Abs(n As Long) As Long
+	If n < 0 Then
+		Abs = -n
+	Else
+		Abs = n
+	End If
+End Function
+
+Function Abs(n As Integer) As Integer
+	If n < 0 Then
+		Abs = -n
+	Else
+		Abs = n
+	End If
+End Function
+
+Function Abs(n As SByte) As SByte
+	If n < 0 Then
+		Abs = -n
+	Else
+		Abs = n
+	End If
+End Function
+
+'----
+'指数・対数
+
+Function Exp(x As Double) As Double
+	If IsNaN(x) Then
+		Return x
+	Else If IsInf(x) Then
+		If 0 > x Then
+			Return 0
+		Else
+			Return x
+		End If
+	End If
+	Dim k As Long
+	If x >= 0 Then
+		k = Fix(x / Detail._System_LOG2 + 0.5)
+	Else
+		k = Fix(x / Detail._System_LOG2 - 0.5)
+	End If
+
+	x -= k * Detail._System_LOG2
+
+	Dim x2 = x * x
+	Dim w = x2 / 22
+
+	Dim i = 18
+	While i >= 6
+		w = x2 / (w + i)
+		i -= 4
+	Wend
+
+	Return ldexp((2 + w + x) / (2 + w - x), k)
+End Function
+
+Function Log1p(x As Double) As Double
+	If x < -1 Or IsNaN(x) Then
+		Log1p = Detail.GetNaN()
+	ElseIf x = 0 Then
+		x = 0
+	ElseIf IsInf(x) Then
+		Log1p = x
+	Else
+		Log1p = Detail.Log1p(x)
+	End If
+End Function
+
+Function Log(x As Double) As Double
+	If x = 0 Then
+		Log = Detail.GetInf(True)
+	ElseIf x < 0 Or IsNaN(x) Then
+		Log = Detail.GetNaN()
+	ElseIf IsInf(x) Then
+		Log = x
+	Else
+		Dim tmp = x * Detail._System_InverseSqrt2
+		Dim p = VarPtr(tmp) As *QWord
+		Dim m = GetQWord(p) And &h7FF0000000000000
+		Dim k = ((m >> 52) As DWord) As Long - 1022
+		SetQWord(p, m + &h0010000000000000)
+		x /= tmp
+		Log = Detail._System_LOG2 * k + Detail.Log1p(x - 1)
+	End If
+End Function
+
+Function Log10(x As Double) As Double
+	Return Log(x) * Detail._System_InverseLn10
+End Function
+
+'----
+'三角関数
+Function Sin(x As Double) As Double
+	If IsNaN(x) Then
+		Return x
+	ElseIf IsInf(x) Then
+		Return Detail.GetNaN()
+		Exit Function
+	End If
+
+	Dim k As Long
+	Dim t As Double
+
+	t = Detail._Support_tan((x * 0.5) As Double, k)
+	t = 2 * t / (1 + t * t)
+	If (k And 1) = 0 Then 'k mod 2 = 0 Then
+		Return t
+	Else
+		Return -t
+	End If
+End Function
+
+Function Cos(x As Double) As Double
+	If IsNaN(x) Then
+		Return x
+	ElseIf IsInf(x) Then
+		Return Detail.GetNaN()
+	End If
+
+	Return Sin((Detail._System_HalfPI - Abs(x)) As Double)
+End Function
+
+Function Tan(x As Double) As Double
+	If IsNaN(x) Then
+		Tan = x
+		Exit Function
+	ElseIf IsInf(x) Then
+		Tan = Detail.GetNaN()
+		Exit Function
+	End If
+
+	Dim k As Long
+	Dim t As Double
+	t = Detail._Support_tan(x, k)
+	If (k And 1) = 0 Then 'k mod 2 = 0 Then
+		Return t
+	ElseIf t <> 0 Then
+		Return -1 / t
+	Else
+		Return CopySign(Detail.GetInf(False), -t)
+	End If
+End Function
+
+'--
+'三角関数の逆関数
+Function Asin(x As Double) As Double
+	If x < -1 Or x > 1 Then
+		Asin = Detail.GetNaN()
+	Else
+		Asin = Atan(x / Sqrt(1 - x * x))
+	End If
+End Function
+
+Function Acos(x As Double) As Double
+	If x < -1 Or x > 1 Then
+		Acos = Detail.GetNaN()
+	Else
+		Acos = Detail._System_HalfPI - Asin(x)
+	End If
+End Function
+
+Function Atan(x As Double) As Double
+	If IsNaN(x) Then
+		Atan = x
+		Exit Function
+	ElseIf IsInf(x) Then
+		Atan = CopySign(_System_PI, x)
+		Exit Function
+	End If
+	Dim i As Long
+	Dim sgn As Long
+	Dim dbl = 0 As Double
+
+	If x > 1 Then
+		sgn = 1
+		x = 1 / x
+	ElseIf x < -1 Then
+		sgn = -1
+		x = 1 / x
+	Else
+		sgn = 0
+	End If
+
+	For i = Detail._System_Atan_N To 1 Step -1
+		Dim t As Double
+		t = i * x
+		dbl = (t * t) / (2 * i + 1 + dbl)
+	Next
+
+	If sgn > 0 Then
+		Atan = Detail._System_HalfPI - x / (1 + dbl)
+	ElseIf sgn < 0 Then
+		Atan = -Detail._System_HalfPI - x / (1 + dbl)
+	Else
+		Atan = x / (1 + dbl)
+	End If
+End Function
+
+Function Atan2(y As Double, x As Double) As Double
+	If x = 0 Then
+		Atan2 = Sgn(y) * Detail._System_HalfPI
+	Else
+		Atan2 = Atn(y / x)
+		If x < 0 Then
+			Atan2 += CopySign(_System_PI, y)
+		End If
+	End If
+End Function
+
+'----
+'双曲線関数
+Function Sinh(x As Double) As Double
+	If Abs(x) > Detail._System_EPS5 Then
+		Dim t As Double
+		t = Exp(x)
+		Return (t - 1 / t) * 0.5
+	Else
+		Return x * (1 + x * x * 0.166666666666667) ' x * (1 + x * x / 6)
+	End If
+End Function
+
+Function Tanh(x As Double) As Double
+	If x > Detail._System_EPS5 Then
+		Return 2 / (1 + Exp(-2 * x)) - 1
+	ElseIf x < -Detail._System_EPS5 Then
+		Return 1 - 2 / (Exp(2 * x) + 1)
+	Else
+		Return x * (1 - x * x * 0.333333333333333) 'x * (1 - x * x / 3)
+	End If
+End Function
+
+
+'----
+'浮動小数点数判定
+Function IsNaN(ByVal x As Double) As Boolean
+	Dim p = VarPtr(x) As *DWord
+	IsNaN = False
+	If (p[1] And &H7FF00000) = &H7FF00000 Then
+		If (p[0] <> 0) Or ((p[1] And &HFFFFF) <> 0) Then
+			IsNaN = True
+		End If
+	End If
+End Function
+
+Function IsInf(x As Double) As Boolean
+	Dim p = VarPtr(x) As *DWord
+	p[1] And= &h7fffffff
+	Dim inf = Detail.GetInf(False)
+	IsInf = (memcmp(p As *Byte, VarPtr(inf), SizeOf (Double)) = 0)
+End Function
+
+Function IsFinite(x As Double) As Boolean
+	Dim p = VarPtr(x) As *DWord
+	p[1] And= &H7FF00000
+	IsFinite = ( p[1] And &H7FF00000 ) = &H7FF00000
+End Function
+
+'----
+'その他
 Function Hypot(x As Double, y As Double) As Double
 	If x = 0 Then
@@ -33,39 +419,4 @@
 End Function
 
-Function Log1p(x As Double) As Double
-	If x < -1 Or IsNaN(x) Then
-		Log1p = ActiveBasic.Math.Detail.GetNaN()
-	ElseIf x = 0 Then
-		x = 0
-	ElseIf IsInf(x) Then
-		Log1p = x
-	Else
-		Log1p = ActiveBasic.Math.Detail.Log1p(x)
-	End If
-End Function
-
-Function IsNaN(ByVal x As Double) As Boolean
-	Dim p = VarPtr(x) As *DWord
-	IsNaN = False
-	If (p[1] And &H7FF00000) = &H7FF00000 Then
-		If (p[0] <> 0) Or ((p[1] And &HFFFFF) <> 0) Then
-			IsNaN = True
-		End If
-	End If
-End Function
-
-Function IsInf(x As Double) As Boolean
-	Dim p = VarPtr(x) As *DWord
-	p[1] And= &h7fffffff
-	Dim inf = ActiveBasic.Math.Detail.GetInf(False)
-	IsInf = (memcmp(p As *Byte, VarPtr(inf), SizeOf (Double)) = 0)
-End Function
-
-Function IsFinite(x As Double) As Boolean
-	Dim p = VarPtr(x) As *DWord
-	p[1] And= &H7FF00000
-	IsFinite = ( p[1] And &H7FF00000 ) = &H7FF00000
-End Function
-
 Namespace Detail
 
@@ -111,5 +462,5 @@
 Function Log1p(x As Double) As Double
 	Dim s = 0 As Double
-	Dim i = 7 As Long
+	Dim i = _System_Log_N As Long
 	While i >= 1
 		Dim t = (i * x) As Double
@@ -121,11 +472,11 @@
 
 Function _Support_tan(x As Double, ByRef k As Long) As Double
-	If x>=0 Then
-		k=Fix(x/(_System_PI/2)+0.5)
-	Else
-		k=Fix(x/(_System_PI/2)-0.5)
-	End If
-
-	x=(x-(CDbl(3217)/CDbl(2048))*k)+4.4544551033807686783083602485579e-6*k
+	If x >= 0 Then
+		k = ( Fix(x * _System_InverseHalfPI) + 0.5 ) As Long
+	Else
+		k = ( Fix(x * _System_InverseHalfPI) - 0.5 ) As Long
+	End If
+
+	x = (x - (3217.0 / 2048.0) * k) + _System_D * k
 
 	Dim x2 = x * x
@@ -133,10 +484,21 @@
 
 	Dim i As Long
-	For i=19 To 3 Step -2
-		t=x2/(i-t)
+	For i = _System_UrTan_N To 3 Step -2
+		t = x2 / (i - t)
 	Next
 
-	_Support_tan=x/(1-t)
-End Function
+	_Support_tan = x / (1 - t)
+End Function
+
+Const _System_D = 4.4544551033807686783083602485579e-6 As Double
+Const _System_UrTan_N = 19 As Long
+Const _System_EPS5 = 0.001 As Double
+Const _System_Atan_N = 20 As Long
+Const _System_HalfPI = (_System_PI * 0.5)
+Const _System_InverseHalfPI = (2 / _System_PI) '1 / (PI / 2)
+Const _System_InverseLn10 = 0.43429448190325182765112891891661 '1 / (ln 10)
+Const _System_InverseSqrt2 = 0.70710678118654752440084436210485 '1 / (√2)
+Const _System_LOG2 = 0.6931471805599453094172321214581765680755
+Const _System_Log_N = 7 As Long
 
 End Namespace 'Detail
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Strings/SPrintF.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Strings/SPrintF.ab	(revision 587)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Strings/SPrintF.ab	(revision 589)
@@ -376,5 +376,5 @@
 Sub FormatFloatG_RemoveLowDigit(sb As System.Text.StringBuilder, start As Long, flags As FormatFlags)
 	Imports ActiveBasic.Strings
-	
+
 	Dim count = sb.Length
 	If (flags And Alt) = 0 Then
@@ -694,5 +694,5 @@
 */
 Function IntegerD_Convert(buf As *Char, xq As QWord, flags As FormatFlags) As DWord
-	Return IntegerU_Convert(buf, Abs((xq As DWord) As Long) As DWord, flags)
+	Return IntegerU_Convert(buf, Math.Abs((xq As DWord) As Long) As DWord, flags)
 End Function
 
@@ -703,5 +703,5 @@
 */
 Function IntegerLD_Convert(buf As *Char, x As QWord, flags As FormatFlags) As DWord
-	Return IntegerLU_Convert(buf, Abs(x As Int64) As QWord, flags)
+	Return IntegerLU_Convert(buf, Math.Abs(x As Int64) As QWord, flags)
 End Function
 
Index: trunk/ab5.0/ablib/src/Classes/System/Math.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/System/Math.ab	(revision 587)
+++ trunk/ab5.0/ablib/src/Classes/System/Math.ab	(revision 589)
@@ -24,5 +24,5 @@
 
 	Static Function Abs(value As SByte) As SByte
-		If value<0 then
+		If value<0 Then
 			return -value
 		Else
@@ -32,5 +32,5 @@
 
 	Static Function Abs(value As Integer) As Integer
-		If value<0 then
+		If value<0 Then
 			return -value
 		Else
@@ -40,5 +40,5 @@
 
 	Static Function Abs(value As Long) As Long
-		If value<0 then
+		If value<0 Then
 			return -value
 		Else
@@ -48,5 +48,5 @@
 
 	Static Function Abs(value As Int64) As Int64
-		If value<0 then
+		If value<0 Then
 			return -value
 		Else
@@ -56,65 +56,17 @@
 
 	Static Function Acos(x As Double) As Double
-		If x < -1 Or x > 1 Then
-			Acos = ActiveBasic.Math.Detail.GetNaN()
-		Else
-			Acos = _System_HalfPI - Asin(x)
-		End If
+		Acos = ActiveBasic.Math.Acos(x)
 	End Function
 
 	Static Function Asin(x As Double) As Double
-		If x < -1 Or x > 1 Then
-			Asin = ActiveBasic.Math.Detail.GetNaN()
-		Else
-			Asin = Math.Atan(x / Sqrt(1 - x * x))
-		End If
+		Asin = ActiveBasic.Math.Asin(x)
 	End Function
 
 	Static Function Atan(x As Double) As Double
-		If ActiveBasic.Math.IsNaN(x) Then
-			Atan = x
-			Exit Function
-		ElseIf ActiveBasic.Math.IsInf(x) Then
-			Atan = ActiveBasic.Math.CopySign(_System_PI, x)
-			Exit Function
-		End If
-		Dim i As Long
-		Dim sgn As Long
-		Dim dbl = 0 As Double
-
-		If x > 1 Then
-			sgn = 1
-			x = 1 / x
-		ElseIf x < -1 Then
-			sgn = -1
-			x = 1 / x
-		Else
-			sgn = 0
-		End If
-
-		For i = _System_Atan_N To 1 Step -1
-			Dim t As Double
-			t = i * x
-			dbl = (t * t) / (2 * i + 1 + dbl)
-		Next
-
-		If sgn > 0 Then
-			Atan = _System_HalfPI - x / (1 + dbl)
-		ElseIf sgn < 0 Then
-			Atan = -_System_HalfPI - x / (1 + dbl)
-		Else
-			Atan = x / (1 + dbl)
-		End If
+		Atan = ActiveBasic.Math.Atan(x)
 	End Function
 
 	Static Function Atan2(y As Double, x As Double) As Double
-		If x = 0 Then
-			Atan2 = Sgn(y) * _System_HalfPI
-		Else
-			Atan2 = Atn(y / x)
-			If x < 0 Then
-				Atan2 += ActiveBasic.Math.CopySign(_System_PI, y)
-			End If
-		End If
+		Atan2 = ActiveBasic.Math.Atan2(y, x)
 	End Function
 
@@ -131,21 +83,15 @@
 
 	Static Function Cos(x As Double) As Double
-		If ActiveBasic.Math.IsNaN(x) Then
-			Return x
-		ElseIf ActiveBasic.Math.IsInf(x) Then
-			Return ActiveBasic.Math.Detail.GetNaN()
-		End If
-
-		Return Math.Sin((_System_HalfPI - Math.Abs(x)) As Double)
+		Cos = ActiveBasic.Math.Cos(x)
 	End Function
 
 	Static Function Cosh(value As Double) As Double
 		Dim t = Math.Exp(value)
-		return (t + 1 / t) * 0.5
+		Return (t + 1 / t) * 0.5
 	End Function
 
 	Static Function DivRem(x As Long, y As Long, ByRef ret As Long) As Long
 		ret = x Mod y
-		return x \ y
+		Return x \ y
 	End Function
 
@@ -155,35 +101,6 @@
 	End Function
 
-	'Equals
-
 	Static Function Exp(x As Double) As Double
-		If ActiveBasic.Math.IsNaN(x) Then
-			Return x
-		Else If ActiveBasic.Math.IsInf(x) Then
-			If 0 > x Then
-				Return 0
-			Else
-				Return x
-			End If
-		End If
-		Dim k As Long
-		If x >= 0 Then
-			k = Fix(x / _System_LOG2 + 0.5)
-		Else
-			k = Fix(x / _System_LOG2 - 0.5)
-		End If
-
-		x -= k * _System_LOG2
-
-		Dim x2 = x * x
-		Dim w = x2 / 22
-
-		Dim i = 18
-		While i >= 6
-			w = x2 / (w + i)
-			i -= 4
-		Wend
-
-		Return ldexp((2 + w + x) / (2 + w - x), k)
+		Exp = ActiveBasic.Math.Exp(x)
 	End Function
 
@@ -216,27 +133,13 @@
 
 	Static Function Log(x As Double) As Double
-		If x = 0 Then
-			Log = ActiveBasic.Math.Detail.GetInf(True)
-		ElseIf x < 0 Or ActiveBasic.Math.IsNaN(x) Then
-			Log = ActiveBasic.Math.Detail.GetNaN()
-		ElseIf ActiveBasic.Math.IsInf(x) Then
-			Log = x
-		Else
-			Dim tmp = x * _System_InverseSqrt2
-			Dim p = VarPtr(tmp) As *QWord
-			Dim m = GetQWord(p) And &h7FF0000000000000
-			Dim k = ((m >> 52) As DWord) As Long - 1022
-			SetQWord(p, m + &h0010000000000000)
-			x /= tmp
-			Log = _System_LOG2 * k + ActiveBasic.Math.Detail.Log1p(x - 1)
-		End If
+		Log = ActiveBasic.Math.Log(x)
 	End Function
 
 	Static Function Log10(x As Double) As Double
-		Return Math.Log(x) * _System_InverseLn10
+		Log = ActiveBasic.Math.Log10(x)
 	End Function
 
 	Static Function Max(value1 As Byte, value2 As Byte) As Byte
-		If value1>value2 then
+		If value1>value2 Then
 			return value1
 		Else
@@ -246,5 +149,5 @@
 
 	Static Function Max(value1 As SByte, value2 As SByte) As SByte
-		If value1>value2 then
+		If value1>value2 Then
 			return value1
 		Else
@@ -254,5 +157,5 @@
 
 	Static Function Max(value1 As Word, value2 As Word) As Word
-		If value1>value2 then
+		If value1>value2 Then
 			return value1
 		Else
@@ -262,5 +165,5 @@
 
 	Static Function Max(value1 As Integer, value2 As Integer) As Integer
-		If value1>value2 then
+		If value1>value2 Then
 			return value1
 		Else
@@ -270,5 +173,5 @@
 
 	Static Function Max(value1 As DWord, value2 As DWord) As DWord
-		If value1>value2 then
+		If value1>value2 Then
 			return value1
 		Else
@@ -278,5 +181,5 @@
 
 	Static Function Max(value1 As Long, value2 As Long) As Long
-		If value1>value2 then
+		If value1>value2 Then
 			return value1
 		Else
@@ -286,5 +189,5 @@
 
 	Static Function Max(value1 As QWord, value2 As QWord) As QWord
-		If value1>value2 then
+		If value1>value2 Then
 			return value1
 		Else
@@ -294,5 +197,5 @@
 
 	Static Function Max(value1 As Int64, value2 As Int64) As Int64
-		If value1>value2 then
+		If value1>value2 Then
 			return value1
 		Else
@@ -302,5 +205,5 @@
 
 	Static Function Max(value1 As Single, value2 As Single) As Single
-		If value1>value2 then
+		If value1>value2 Then
 			return value1
 		Else
@@ -310,5 +213,5 @@
 
 	Static Function Max(value1 As Double, value2 As Double) As Double
-		If value1>value2 then
+		If value1>value2 Then
 			return value1
 		Else
@@ -318,5 +221,5 @@
 
 	Static Function Min(value1 As Byte, value2 As Byte) As Byte
-		If value1<value2 then
+		If value1<value2 Then
 			return value1
 		Else
@@ -326,5 +229,5 @@
 
 	Static Function Min(value1 As SByte, value2 As SByte) As SByte
-		If value1<value2 then
+		If value1<value2 Then
 			return value1
 		Else
@@ -334,5 +237,5 @@
 
 	Static Function Min(value1 As Word, value2 As Word) As Word
-		If value1<value2 then
+		If value1<value2 Then
 			return value1
 		Else
@@ -342,5 +245,5 @@
 
 	Static Function Min(value1 As Integer, value2 As Integer) As Integer
-		If value1<value2 then
+		If value1<value2 Then
 			return value1
 		Else
@@ -350,5 +253,5 @@
 
 	Static Function Min(value1 As DWord, value2 As DWord) As DWord
-		If value1<value2 then
+		If value1<value2 Then
 			return value1
 		Else
@@ -358,5 +261,5 @@
 
 	Static Function Min(value1 As Long, value2 As Long) As Long
-		If value1<value2 then
+		If value1<value2 Then
 			return value1
 		Else
@@ -366,5 +269,5 @@
 
 	Static Function Min(value1 As QWord, value2 As QWord) As QWord
-		If value1<value2 then
+		If value1<value2 Then
 			return value1
 		Else
@@ -374,5 +277,5 @@
 
 	Static Function Min(value1 As Int64, value2 As Int64) As Int64
-		If value1<value2 then
+		If value1<value2 Then
 			return value1
 		Else
@@ -382,5 +285,5 @@
 
 	Static Function Min(value1 As Single, value2 As Single) As Single
-		If value1<value2 then
+		If value1<value2 Then
 			return value1
 		Else
@@ -390,5 +293,5 @@
 
 	Static Function Min(value1 As Double, value2 As Double) As Double
-		If value1<value2 then
+		If value1<value2 Then
 			return value1
 		Else
@@ -404,7 +307,7 @@
 
 	Static Function Round(value As Double) As Double'他のバージョン、誰か頼む。
-		If value+0.5<>Int(value+0.5) then
+		If value+0.5<>Int(value+0.5) Then
 			value=Int(value+0.5)
-		ElseIf Int(value+0.5)=Int(value*2+1)/2 then
+		ElseIf Int(value+0.5)=Int(value*2+1)/2 Then
 			value=Int(value+0.5)
 		Else
@@ -414,17 +317,17 @@
 
 	Static Function Sign(value As Double) As Long
-		If value = 0 then
-			return 0
-		ElseIf value > 0 then
-			return 1
-		Else
-			return -1
-		End If
-	End Function
-
+		If value = 0 Then
+			return 0
+		ElseIf value > 0 Then
+			return 1
+		Else
+			return -1
+		End If
+	End Function
+/*
 	Static Function Sign(value As SByte) As Long
-		If value = 0 then
-			return 0
-		ElseIf value > 0 then
+		If value = 0 Then
+			return 0
+		ElseIf value > 0 Then
 			return 1
 		Else
@@ -434,7 +337,7 @@
 
 	Static Function Sign(value As Integer) As Long
-		If value = 0 then
-			return 0
-		ElseIf value > 0 then
+		If value = 0 Then
+			return 0
+		ElseIf value > 0 Then
 			return 1
 		Else
@@ -444,7 +347,7 @@
 
 	Static Function Sign(value As Long) As Long
-		If value = 0 then
-			return 0
-		ElseIf value > 0 then
+		If value = 0 Then
+			return 0
+		ElseIf value > 0 Then
 			return 1
 		Else
@@ -454,7 +357,7 @@
 
 	Static Function Sign(value As Int64) As Long
-		If value = 0 then
-			return 0
-		ElseIf value > 0 then
+		If value = 0 Then
+			return 0
+		ElseIf value > 0 Then
 			return 1
 		Else
@@ -464,135 +367,37 @@
 
 	Static Function Sign(value As Single) As Long
-		If value = 0 then
-			return 0
-		ElseIf value > 0 then
-			return 1
-		Else
-			return -1
-		End If
-	End Function
-
-	Static Function Sin(value As Double) As Double
-		If ActiveBasic.Math.IsNaN(value) Then
-			Return value
-		ElseIf ActiveBasic.Math.IsInf(value) Then
-			Return ActiveBasic.Math.Detail.GetNaN()
-			Exit Function
-		End If
-
-		Dim k As Long
-		Dim t As Double
-
-		t = urTan((value * 0.5) As Double, k)
-		t = 2 * t / (1 + t * t)
-		If (k And 1) = 0 Then 'k mod 2 = 0 Then
-			Return t
-		Else
-			Return -t
-		End If
+		If value = 0 Then
+			return 0
+		ElseIf value > 0 Then
+			return 1
+		Else
+			return -1
+		End If
+	End Function
+*/
+	Static Function Sin(x As Double) As Double
+		Sin = ActiveBasic.Math.Sin(x)
 	End Function
 
 	Static Function Sinh(x As Double) As Double
-		If Math.Abs(x) > _System_EPS5 Then
-			Dim t As Double
-			t = Math.Exp(x)
-			Return (t - 1 / t) * 0.5
-		Else
-			Return x * (1 + x * x * 0.166666666666667) ' x * (1 + x * x / 6)
-		End If
+		Sinh = ActiveBasic.Math.Sinh(x)
 	End Function
 
 	Static Function Sqrt(x As Double) As Double
-		If x > 0 Then
-			If ActiveBasic.Math.IsInf(x) Then
-				Sqrt = x
-			Else
-				Sqrt = x
-				Dim i = (VarPtr(Sqrt) + 6) As *Word
-				Dim jj = GetWord(i) As Long
-				Dim j = jj >> 5 As Long
-				Dim k = (jj And &h0000001f) As Long
-				j = (j + 511) << 4 + k
-				SetWord(i, j)
-				Dim last As Double
-				Do
-					last = Sqrt
-					Sqrt = (x / Sqrt + Sqrt) * 0.5
-				Loop While Sqrt <> last
-			End If
-		ElseIf x < 0 Then
-			Sqrt = ActiveBasic.Math.Detail.GetNaN()
-		Else
-			'x = 0 Or NaN
-			Sqrt = x
-		End If
+		Sqrt = ActiveBasic.Math.Sqrt(x)
 	End Function
 
 	Static Function Tan(x As Double) As Double
-		If ActiveBasic.Math.IsNaN(x) Then
-			Tan = x
-			Exit Function
-		ElseIf ActiveBasic.Math.IsInf(x) Then
-			Tan = ActiveBasic.Math.Detail.GetNaN()
-			Exit Function
-		End If
-
-		Dim k As Long
-		Dim t As Double
-		t = urTan(x, k)
-		If (k And 1) = 0 Then 'k mod 2 = 0 Then
-			Return t
-		ElseIf t <> 0 Then
-			Return -1 / t
-		Else
-			Return ActiveBasic.Math.CopySign(ActiveBasic.Math.Detail.GetInf(False), -t)
-		End If
+		Tan = ActiveBasic.Math.Tan(x)
 	End Function
 
 	Static Function Tanh(x As Double) As Double
-		If x > _System_EPS5 Then
-			Return 2 / (1 + Math.Exp(-2 * x)) - 1
-		ElseIf x < -_System_EPS5 Then
-			Return 1 - 2 / (Math.Exp(2 * x) + 1)
-		Else
-			Return x * (1 - x * x * 0.333333333333333) 'x * (1 - x * x / 3)
-		End If
-	End Function
-
-	'ToString
+		Tanh = ActiveBasic.Math.Tanh(x)
+	End Function
 
 	Static Function Truncate(x As Double) As Double
 		Return Fix(x)
 	End Function
-
-'Private
-	Static Function urTan(x As Double, ByRef k As Long) As Double
-		Dim i As Long
-		Dim t As Double, x2 As Double
-
-		If x >= 0 Then
-			k = ( Fix(x * _System_InverseHalfPI) + 0.5 ) As Long
-		Else
-			k = ( Fix(x * _System_InverseHalfPI) - 0.5 ) As Long
-		End If
-		x = (x - (3217.0 / 2048.0) * k) + _System_D * k
-		x2 = x * x
-		t = 0
-		For i = _System_UrTan_N To 3 Step -2
-			t = x2 / (i - t)
-		Next i
-		urTan =  x / (1 - t)
-	End Function
-Private
-	Static Const _System_Atan_N = 20 As Long
-	Static Const _System_UrTan_N = 17 As Long
-	Static Const _System_D = 4.4544551033807686783083602485579e-6 As Double
-	Static Const _System_EPS5 = 0.001 As Double
 End Class
 
 End Namespace
-
-Const _System_HalfPI = (_System_PI * 0.5)
-Const _System_InverseHalfPI = (2 / _System_PI) '1 / (PI / 2)
-Const _System_InverseLn10 = 0.43429448190325182765112891891661 '1 / (ln 10)
-Const _System_InverseSqrt2 = 0.70710678118654752440084436210485 '1 / (√2)
