FP accuracy

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

Let's get real about this.  The are infinitely many real numbers that cannot
be represented exactly with a finite number of bits--perhaps the most
commonly encountered: 1/3. Note that decimal can't represent this in a
finite number of digits either.

The significance of this is that there will be "fuzz" in fp calculations no
matter how many bits/digits are used.  The advantage of using more
bits/digits is that the fuzz occurs in the least significant places--so it
would seem that more bits is always better, but there is the tradeoff of
accuracy vs. speed and storage size.

Euphoria's accuracy is good enough for most purposes, in the rare cases
where it isn't there are two alternatives:

1. If you can afford to lose speed, use or write a specialized library in
Eu.

2. If not, use assembly--but be aware, you will never get better than 80-bit
accuracy on Intel hardware, unless you use alternative 1 in assembly (which
will cost speed).

-- Mike Nelson

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

Search



Quick Links

User menu

Not signed in.

Misc Menu