SHARE
TWEET

Untitled

a guest Jul 18th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. ; negative
  3. $before = 0.00002001 * 2 / 2
  4. $after = __num64tostr($before)
  5. MsgBox(0, "before: " & $before, "after: " & $after)
  6.  
  7. ;~ ; positive
  8. $before = 59584773894018382 * 2 / 2
  9. $after = __num64tostr($before)
  10. MsgBox(0, "before: " & $before, "after: " & $after)
  11.  
  12.  
  13. Func __num64tostr($dec)
  14.     If StringRegExp($dec, "e") = False Then Return $dec
  15.  
  16.     Local $split = StringSplit($dec, "e", 1)
  17.  
  18.     If StringLeft($split[2], 1) = "-" Then
  19.  
  20.         $split[2] = Number(StringTrimLeft($split[2], 1))
  21.         Local $ret = "0."
  22.         For $i = 1 To $split[2]
  23.             $ret &= "0"
  24.         Next
  25.         Return $ret & Number($split[1]) * (10^$split[2])
  26.     Else
  27.  
  28.         Local $struct = DllStructCreate("int64;")
  29.         DllStructSetData($struct, 1, Number($split[1]) * (10^Number($split[2])))
  30.         Return DllStructGetData($struct, 1)
  31.     EndIf
  32. 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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top