Re: Current implementation of exp() is faulty.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Here's an excerpt from Matt's scientific.e documentation:

"This library evaluates scientific notation to the highest level of precision
possible using Euphoria atoms. An atom can have up to 16 digits of precision. A
number represented by scientific notation could contain up to 17 digits. The 17th
supplied digit may have an effect upon the value of the atom due to rounding
errors in the calculations.

This doesn't mean that if the 17th digit is 5 or higher, you should include it.
The calculations are much more complicated, because a decimal fraction has to be
converted to a binary fraction, and there's not really a one-to-one
correspondence between the decimal digits and the bits in the resulting atom. The
18th or higher digit, however, will never have an effect on the resulting atom. "

Of course, the item of interest is "there's not really a one-to-one
correspondence between the decimal digits and the bits in the resulting atom."

Converting from binary representation to a string is a pretty good compromise.
Converting from string to a binary representation will almost always give you
errors.

--
A complex system that works is invariably found to have evolved from a simple
system that works.
--John Gall's 15th law of Systemantics.

"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare

j.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu