Changeset 14 for Include/Classes/System
- Timestamp:
- Nov 27, 2006, 1:20:38 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/Math.ab
r1 r14 1 ' Math.ab1 ' Classes/System/Math.ab 2 2 3 3 #ifndef __SYSTEM_MATH_AB__ … … 104 104 For i = _System_Atan_N To 1 Step -1 105 105 Dim t As Double 106 t = i * number106 t = i * x 107 107 dbl = (t * t) / (2 * i + 1 + dbl) 108 108 Next … … 128 128 End Function 129 129 130 Static Function BigMul( value1 As Long, value2As Long) As Int64131 Return ( value1 As Int64) * value2130 Static Function BigMul(x As Long, y As Long) As Int64 131 Return (x As Int64) * y 132 132 End Function 133 133 … … 140 140 End Function 141 141 142 Static Function Cos( valueAs Double) As Double143 If IsNaN( number) Then144 Return number145 ElseIf IsInf(number) Then142 Static Function Cos(x As Double) As Double 143 If IsNaN(x) Then 144 Return x 145 ElseIf IsInf(x) Then 146 146 Return _System_GetNaN() 147 147 End If 148 148 149 Return Sin(_System_HalfPI - Abs( number))149 Return Sin(_System_HalfPI - Abs(x)) 150 150 End Function 151 151 … … 156 156 End Function 157 157 158 Static Function DivRem( value1 As Long, value2As Long, ByRef ret As Long) As Long159 ret = value1 Mod value2160 return value1 \ value2161 End Function 162 163 Static Function DivRem( value1 As Int64, value2As Int64, ByRef ret As Int64) As Int64164 ret = value1 - (value1 \ value2) * value2165 return value1 \ value2158 Static Function DivRem(x As Long, y As Long, ByRef ret As Long) As Long 159 ret = x Mod y 160 return x \ y 161 End Function 162 163 Static Function DivRem(x As Int64, y As Int64, ByRef ret As Int64) As Int64 164 ret = x - (x \ y) * y 165 return x \ y 166 166 End Function 167 167 168 168 'Equals 169 169 170 Static Function Exp( valueAs Double) As Double170 Static Function Exp(x As Double) As Double 171 171 If IsNaN(x) Then 172 172 Return x … … 182 182 183 183 If x >= 0 Then 184 k = Fix(x / _System_LOG2 + 0.5)185 Else 186 k = Fix(x / _System_LOG2 - 0.5)184 k = Fix(x / _System_LOG2 + 0.5) 185 Else 186 k = Fix(x / _System_LOG2 - 0.5) 187 187 End If 188 188 … … 423 423 End Function 424 424 425 Static Function Pow( value1 As Double, value2As Double) As Double426 return value1 ^ value2425 Static Function Pow(x As Double, y As Double) As Double 426 return pow(x, y) 427 427 End Function 428 428 … … 532 532 Dim s As Double, last As Double 533 533 Dim i As *Word, j As Long, jj As Long, k As Long 534 If number> 0 Then535 If IsInf( number) Then534 If x > 0 Then 535 If IsInf(x) Then 536 536 Sqrt = x 537 537 Else … … 548 548 Loop While s <> last 549 549 End If 550 If x < 0 Then550 ElseIf x < 0 Then 551 551 Sqr = _System_GetNaN() 552 552 Else … … 556 556 End Function 557 557 558 Static Function Tan( valueAs Double) As Double559 If IsNaN( number) Then560 Tan = number558 Static Function Tan(x As Double) As Double 559 If IsNaN(x) Then 560 Tan = x 561 561 Exit Function 562 ElseIf IsInf( number) Then562 ElseIf IsInf(x) Then 563 563 Tan = _System_GetNaN() 564 564 Exit Function … … 593 593 End Function 594 594 595 Private595 'Private 596 596 Static Function urTan(x As Double, ByRef k As Long) As Double 597 597 Dim i As Long
Note:
See TracChangeset
for help on using the changeset viewer.