This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: glibc conditioning

> From: Jinsong Zhao <>
> Date: 27 Aug 2001 15:52:46 -0700
>     double d=0.3;
>     int i = (int)(1000*d);
> Only on Linux i is 299,

Not true.  On Solaris 8 (x86), i is 299.  I just tried it.
(This was compiled with gcc 2.95.2, not that I think it matters.)

> I guess this is just one of the demonstrated behavior that says
> Linux is different from everyone else on floating point operations.

It sounds like somebody at your company misunderstands how floating
point works.  Unfortunately it's not a simple subject, but for more
about it, please see David Goldberg's fine paper:

David Goldberg
What every computer scientist should know about floating-point arithmetic
ACM Computing Surveys 23, 1 (1991-03), 5-48

> There is no point in arguing with me what is the strictly right answer
> according to some standard. The point is, as an OS/library user, I
> want to have consistent results.

Then you cannot rely on IEEE floating point.  The IEEE floating point
standard does not guarantee the exact same results on all conforming
platforms.  Sorry, but that's life.  Please read Goldberg's paper for
more information.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]