How do I make AppleScript count exactly?
According to AppleScript, the following equation would be true:89723443578920345892 / 2 = 448617217894600000000
That, though, is not true. What can I do in order to make AppleScript actually count without rounding it afterward?
Best Answer
The command line utility
bc
is capable of arbitrary precision mathematics, and you can call a command line utility from AppleScript and get a value from it.For example:
Gives this result:
44861721789460172946
To pass command line arguments as AppleScript variables:
But this gets us back to the original problem, AppleScript represents large numbers as a float, so I had to pass the value as a string. So depending on where you get the very large number from, this could be problematic or a non-solution.