Re: Current implementation of exp() is faulty.

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

CChris wrote:
> 
> Matt Lewis wrote:
> > 
> > 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.

Yes, this was what I was referring to with respect to the current "naive"
algorithm.

> 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...

I suspect from this comment that you haven't really looked at scientific.e.  
It converts decimal strings to binary, and does manipulations based upon the
binary representation with as much precision as is possible to capture with
a double floating point representation.

Matt

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

Search



Quick Links

User menu

Not signed in.

Misc Menu