## [REBOL] Re: Arithmetic precision

### From: gjones05:mail:orion at: 3-Feb-2001 18:40

Hi, Colin,
Colin wrote:

> Is there any way in Rebol that I can extend the number of significant

digits

> when doing arithmetic?

...
Andrew's email reminded me that I had started this message this morning,
then left it unfinished.
Geo pointed out a mathematical principle I had long since forgotten (thanks,
Geo, for "reminding" me that I must suffer from Alzheimer's or Mad Cow
disease, or both! ;-).
Outside of doing higher precision math with strings, there are single
purpose tricks for specific problems. You may already know this and are
simply trying to make a point, for which I will apologize in advance.
For the first example question, using the two original numbers 1000000001
and 71, the whole number portion can be obtained from division. Then obtain
the fractional portion by starting with the remainder function (or //).
Divide this "remainder" by 71. This then represents the fraction portion
and allows more degrees of significance.
Hardly very satisfying, I know. Only a more general purpose unit would
really address the issue.
Out of curiosity, I checked out vbscript and it gave 14084507.056338, the
same level as REBOL. Then I checked Tcl set at it's default precision level
of 12 giving 14084507.0563. Then I set Tcl to its maximum of 17, and
received 14084507.056338029. These scripting languages seem to give
similar, disappointing results if one is looking for high precision math.
Next I checked out the equation 123456789.123456789 - 123456789. VBScript:
0.123456791043282. Tcl(set to its max): 0.12345679104328156. Again, I
think REBOL hits in the same ballpark.
I guess if one can really measure a phenomenon to a degree of precision that
then the math warrants a high precision package, then none of these
pre-baked scripting languages are going to do the trick. I suspect that the
same prinicple is true with most languages, which generally require add-on
units to attack these sorts of problems. Rexx seems special in this regard,
but I know little about. Outside of decreased speed in mathematical
functions, I guess using a string datatype can prove to be more of a
hindrance in other areas.
Well, as always, this information and 35 cents may buy you a phone call, if
you are lucky. Good luck in the search for higher precision!
-Scott