Re: Current implementation of exp() is faulty.

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

Matt Lewis wrote:
> 
> Jason Gade wrote:
> > 
> > Here's an excerpt from Matt's scientific.e documentation:
> > 
> <snip>
> 
> Yes.  Also, it's only currently used for scientific notation encountered.
> It should be fairly easy to make it parse all floating point, though this
> would slow things down a little.  Not sure where the sweet spot would
> be (i.e., when do we lose precision in the current "naive" algorithm).
> 
> Matt

Precision is lost when you add roundoff errors together. If, when parsing, you
add 16 numbers of the form n.0E-p, none of them is exactly representable, so you
get 16 times the maximum error, on bad days.

I have coded an alternative which performs arithmetic on the digits of the
string being parsed, so as to never combine inexact results. It supports an exact
mode (givve this many bits of precision) and an auto-round mode (give as much
precision as one can get with the available digits).

I'll benchmark it against scientific.e - it's probably slower and more accurate
- and post the findings. A few other things to do these days...

CChris

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

Search



Quick Links

User menu

Not signed in.

Misc Menu