[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Division in C++
From: |
Andre Poenitz |
Subject: |
Re: Division in C++ |
Date: |
10 Aug 2005 11:53:07 -0400 |
Onno Garms <garms@gmx.de> wrote:
> Regardless of any rounding errors, a/b should always return
> the same value, shouldn't it?
Not necessarily. Especially on Intel it makes a difference whether
everything happens within the FPU (80bit IIRC) or whether some result or
intermediate result is stored outside (64bit).
Never, ever, trust floating point arithmetic.
Andre'
PS: Check out the -ffloat-store compiler option.
[Floating point arithmetic is perfectly well defined, but the rules are
different from fixed point, and as you note, intermediate precision
matters a lot. -John]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Division in C++,
Andre Poenitz <=