- Timestamp:
- May 19, 2007, 3:29:33 PM (18 years ago)
- Location:
- Include
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/Math.ab
r244 r257 232 232 Dim tmp = x * _System_InverseSqrt2 233 233 Dim p = VarPtr(tmp) As *QWord 234 Dim m = p[0]And &h7FF0000000000000234 Dim m = GetQWord(p) And &h7FF0000000000000 235 235 Dim k = ((m >> 52) As DWord) As Long - 1022 236 p[0] = m + &h0010000000000000236 SetQWord(p, m + &h0010000000000000) 237 237 x /= tmp 238 239 x-- 240 Dim s = 0 As Double 241 Dim i = _System_Log_N As Long 242 While i >= 1 243 Dim t = (i * x) As Double 244 s = t / (2 + t / (2 * i + 1 + s)) 245 i-- 246 Wend 247 Log = _System_LOG2 * k + x / (1 + s) 238 Log = _System_LOG2 * k + _System_Log1p(x - 1) 248 239 End If 249 240 End Function … … 602 593 End Function 603 594 Private 604 Static Const _System_Log_N = 7 As Long605 595 Static Const _System_Atan_N = 20 As Long 606 596 Static Const _System_UrTan_N = 17 As Long -
Include/Classes/System/OperatingSystem.ab
r237 r257 10 10 Public 11 11 ' Constractor 12 Sub OperatingSystem(platform As PlatformID, version As Version)12 Sub OperatingSystem(platform As PlatformID, version As System.Version) 13 13 pf = platform 14 14 ver = version … … 18 18 Sub OperatingSystem(vi As OSVERSIONINFOA) 19 19 pf = vi.dwPlatformId As PlatformID 20 ver = New Version(vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber)20 ver = New System.Version(vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber) 21 21 sp = New String(vi.szCSDVersion As PCSTR) 22 22 End Sub … … 24 24 Sub OperatingSystem(vi As OSVERSIONINFOW) 25 25 pf = vi.dwPlatformId As PlatformID 26 ver = New Version(vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber)26 ver = New System.Version(vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber) 27 27 sp = New String(vi.szCSDVersion As PCSTR) 28 28 End Sub … … 33 33 End Function 34 34 35 Const Function Version() As Version35 Const Function Version() As System.Version 36 36 Return ver 37 37 End Function … … 71 71 Private 72 72 pf As PlatformID 73 ver As Version73 ver As System.Version 74 74 sp As String 75 75 End Class -
Include/Classes/System/Runtime/InteropServices/GCHandle.ab
r233 r257 12 12 Sub Target(obj As Object) 13 13 allocated.Add(obj) 14 handle = VarPtr(obj) 'ObjPtr14 handle = ObjPtr(obj) 15 15 End Sub 16 16 -
Include/Classes/System/Version.ab
r233 r257 5 5 6 6 #require <api_winsock2.sbp> 7 8 Namespace System 7 9 8 10 Class Version … … 149 151 End Class 150 152 153 End Namespace 'System 154 151 155 #endif '__SYSTEM_VERSION_AB__ -
Include/basic/function.sbp
r251 r257 9 9 Const _System_LOG2 = 0.6931471805599453094172321214581765680755 10 10 Const _System_SQRT2 = 1.41421356237309504880168872421 11 Const _System_Log_N = 7 As Long 11 12 12 13 … … 21 22 Exit Function 22 23 End If 23 Dim pSrc As *QWord, pDest As *QWord 24 pSrc = VarPtr(x) As *QWord 25 pDest = VarPtr(ldexp) As *QWord 26 24 Dim pSrc = VarPtr(x) As *QWord 25 Dim pDest = VarPtr(ldexp) As *QWord 27 26 n += (pSrc[0] >> 52) As DWord And &h7FF 28 29 27 pDest[0] = n << 52 Or (pSrc[0] And &h800FFFFFFFFFFFFF) 30 28 End Function … … 37 35 End If 38 36 39 Dim pSrc As *QWord, pDest As *QWord 40 pSrc = VarPtr(x) As *QWord 41 pDest = VarPtr(frexp) As *QWord 37 Dim pSrc = VarPtr(x) As *QWord 38 Dim pDest = VarPtr(frexp) As *QWord 42 39 n = ((pSrc[0] >> 52) As DWord And &h7FF) - 1022 43 40 pDest[0] = (pSrc[0] And &h800FFFFFFFFFFFFF) Or &h3FE0000000000000 … … 100 97 End Function 101 98 102 Function _System_GetInf(sign As B OOL) As Double99 Function _System_GetInf(sign As Boolean) As Double 103 100 Dim s = 0 As QWord 104 101 If sign Then s = 1 << 63 … … 115 112 End Function 116 113 117 Function _System_GetInf(sign As B OOL) As Double114 Function _System_GetInf(sign As Boolean) As Double 118 115 Dim s = 0 As DWord 119 116 If sign Then s = (1 As DWord) << 31 … … 240 237 End Function 241 238 239 Function Log1p(x As Double) As Double 240 If x < -1 Or IsNaN(x) Then 241 Log1p = _System_GetNaN() 242 ElseIf x = 0 Then 243 x = 0 244 ElseIf IsInf(x) Then 245 Log1p = x 246 Else 247 Log1p = _System_Log1p(x) 248 End If 249 End Function 250 251 Function _System_Log1p(x As Double) As Double 252 Dim s = 0 As Double 253 Dim i = 7 As Long 254 While i >= 1 255 Dim t = (i * x) As Double 256 s = t / (2 + t / (2 * i + 1 + s)) 257 i-- 258 Wend 259 Return x / (1 + s) 260 End Function 261 242 262 Function Sgn(number As Double) As Long 243 263 Sgn = Math.Sign(number) … … 293 313 Dim p As *DWord 294 314 p = VarPtr(x) As *DWord 295 IsNaN = F ALSE315 IsNaN = False 296 316 If (p[1] And &H7FF00000) = &H7FF00000 Then 297 317 If (p[0] <> 0) Or ((p[1] And &HFFFFF) <> 0) Then … … 299 319 End If 300 320 End If 301 302 ' IsNaN=FALSE303 321 End Function 304 322 … … 307 325 p = VarPtr(x) As *DWord 308 326 p[1] And= &h7fffffff 309 nan = _System_GetInf(F ALSE)327 nan = _System_GetInf(False) 310 328 IsInf = (memcmp(p As *Byte, VarPtr(nan), SizeOf (Double)) = 0) 311 329 End Function … … 321 339 p[1] And= &H7FF00000 322 340 p[0] = 0 323 nan = _System_GetInf(/*x,*/ F ALSE)341 nan = _System_GetInf(/*x,*/ False) 324 342 IsFinite = (memcmp(p As BytePtr, VarPtr(nan), SizeOf (Double)) = 0) 325 343 End Function
Note:
See TracChangeset
for help on using the changeset viewer.