Am Mon, 15 Apr 2013 11:51:43 -0400 schrieb "Steven Schveighoffer" <schvei...@yahoo.com>:
> On Mon, 15 Apr 2013 11:51:07 -0400, Steven Schveighoffer > <schvei...@yahoo.com> wrote: > > > I would suspect that the issue is floating point error. On certain > > hardware, the CPU uses higher-precision 80-bit floating points. When > > you store those back to doubles, the extra precision is truncated. > > I see you use float not double, but the point is still valid. > > -Steve What worries me is that this jeopardizes the efforts put into C to make floating point calculations the same under all circumstances. GCC for example has the fast-math switch if you really want just the fastest way to get a result, but otherwise follows strict evaluation and assignment order of floating point math even in const-folding, so situations like these don't occur. I completely agree with your explanation why it happens and I think it is a bug that must be reported to the respective compiler developers. -- Marco