This is the mail archive of the glibc-bugs@sourceware.org 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]
Other format: [Raw text]

[Bug libc/3479] Incorrect rounding in strtod()


------- Additional Comments From Sylvain dot Pion at sophia dot inria dot fr  2009-07-15 14:58 -------
Besides the "Recommended practice" mentioned, Annex F on IEC 60559
floating-point arithmetic, also says :

  "Functions such as strtod that convert character sequences to floating
   types must honor the rounding direction."

It seems like glibc does not honor this, as the following program
illustrates by crashing (on x86_64-linux at least).

#include <stdlib.h>
#include <assert.h>
#include <fenv.h>

int main()
{
	fesetround(FE_UPWARD);
	double d = strtod("0.3", (char**) NULL);
	fesetround(FE_DOWNWARD);
	double e = strtod("0.3", (char**) NULL);
	assert(d != e);
}


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=3479

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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