Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: decimal woes

From: roland:hadinger:arcor at: 18-Jul-2003 21:21

> Do you think this means that print and probe do not contain > all digits of the internal hw decimal value? so that when it > prints 0.92 it only looked at the 15 first digits and there > was still some data past that, which only spills off after > repeated (and expected) rounding errors?
Yes. 'print and 'probe do some rounding, but when the error accumulates (accuracy decreases), it starts to get noticeable.
> if so, does anyone know how to build a print-xtended-decimal function?
No. How would a print-xtended-decimal function know the "right" from the "wrong" bits that have accumulated at the end? I think there are some solutions, but they are... - tricky: store the accuracy (number of significant digits) of each decimal value separately. For each calculation, take into account the accuracies of the operands and estimate accuracy of result. Round accordingly when printing the output, so only significant digits are displayed. - slow: use arbitrary precision math routines (under construction...). - expensive: use something like Maple, MuPAD, or Mathematica, which have most of the above methods already built in. - messy and painful: chop off 10 - (2 ** n) fingers and forget the decimal system :P -- Roland