SHARE
TWEET

Untitled

a guest Jul 18th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  negative
  2. $before = 0.00002001 * 2 / 2
  3. $after = __num64tostr($before)
  4. MsgBox(0, "before: " & $before, "after: " & $after)
  5.  
  6. ; positive
  7. $before = 59584773894018382 * 2 / 2
  8. $after = __num64tostr($before)
  9. MsgBox(0, "before: " & $before, "after: " & $after)
  10.  
  11.  
  12. Func __num64tostr($dec)
  13.     If StringRegExp($dec, "e") = False Then Return $dec
  14.  
  15.     Local $split = StringSplit($dec, "e", 1), $struct
  16.  
  17.     If StringLeft($split[2], 1) = "-" Then
  18.  
  19.         $struct = DllStructCreate("float;")
  20.         $split[2] = StringTrimLeft($split[2], 1)
  21.         DllStructSetData($struct, 1, Number($split[1]) * (10^Number($split[2])))
  22.         Return "0." & DllStructGetData($struct, 1)
  23.  
  24.     Else
  25.  
  26.         $struct = DllStructCreate("int64;")
  27.         DllStructSetData($struct, 1, Number($split[1]) * (10^Number($split[2])))
  28.         Return DllStructGetData($struct, 1)
  29.     EndIf
  30. EndFunc
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top