Changeset 457 for trunk/Include/Classes/System/Math.ab
- Timestamp:
- Mar 6, 2008, 9:49:43 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/Classes/System/Math.ab
r299 r457 127 127 128 128 Static Function Ceiling(x As Double) As Long 129 If Floor(x) = x then 130 Return x As Long 131 Else 132 Return Floor(x) + 1 129 Ceiling = Floor(x) 130 If Ceiling <> x Then 131 Ceiling++ 133 132 End If 134 133 End Function … … 145 144 146 145 Static Function Cosh(value As Double) As Double 147 Dim t As Double 148 t = Math.Exp(value) 146 Dim t = Math.Exp(value) 149 147 return (t + 1 / t) * 0.5 150 148 End Function … … 156 154 157 155 Static Function DivRem(x As Int64, y As Int64, ByRef ret As Int64) As Int64 158 ret = x - (x \ y) *y159 ret urn x \y156 DivRem = x \ y 157 ret = x - (DivRem) * y 160 158 End Function 161 159 … … 196 194 Return Int(value) 197 195 End Function 198 199 'GetHashCode200 201 'GetType202 196 203 197 Static Function IEEERemainder(x As Double, y As Double) As Double … … 513 507 514 508 Static Function Sqrt(x As Double) As Double 515 Dim s As Double, last As Double516 Dim i As *Word, j As Long, jj As Long, k As Long517 509 If x > 0 Then 518 510 If ActiveBasic.Math.IsInf(x) Then … … 520 512 Else 521 513 Sqrt = x 522 i = (VarPtr(Sqrt) + 6) As *Word523 jj = GetWord(i)524 j = jj >> 5525 k = jj And &h0000001f526 j = (j +511) << 4 + k514 Dim i = (VarPtr(Sqrt) + 6) As *Word 515 Dim jj = GetWord(i) As Long 516 Dim j = jj >> 5 As Long 517 Dim k = (jj And &h0000001f) As Long 518 j = (j + 511) << 4 + k 527 519 SetWord(i, j) 520 Dim last As Double 528 521 Do 529 522 last = Sqrt 530 Sqrt = (x / Sqrt + Sqrt) * 0.5523 Sqrt = (x / Sqrt + Sqrt) * 0.5 531 524 Loop While Sqrt <> last 532 525 End If
Note:
See TracChangeset
for help on using the changeset viewer.