Date: Mon, 06 Mar 2000 09:23:43 +0000 From: Matthew Seaman <m.seaman@inpharmatica.co.uk> To: Nobuhiro Yasutomi <nobu@rd.isac.co.jp> Cc: simokawa@sat.t.u-tokyo.ac.jp, gnats-admin@FreeBSD.ORG, freebsd-alpha@FreeBSD.ORG Subject: Re: alpha/17032: strtod(3) floating exception Message-ID: <38C3791F.A2616790@inpharmatica.co.uk> References: <ybshfel4c0q.wl@ett.sat.t.u-tokyo.ac.jp> <20000306154855R.nobu@rd.isac.co.jp>
next in thread | previous in thread | raw e-mail | index | archive | help
Nobuhiro Yasutomi wrote: > > Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp> writes: > > FreeBSD/alpha uses strtod.c obtained from NetBSD, > > i.e. src/lib/libc/stdlib/netbsd_strtod.c. > > Oh, I missed this file. Thanks. > > > > Based NetBSD-current source as > > > $NetBSD: strtod.c,v 1.33 1999/11/26 07:39:45 msaitoh Exp $ > > > > If recent netbsd's strtod.c works without `-mieee', it must be nice. > > Yes, recent netbsd's one works without `-mieee'. > > By the way, I found other case to make `Floating point exception' > the value is "10e-323". This case happen with `-mieee' option. > When without `-mieee', strtod retrun value to 0. But FreeBSD i386's > strtod make 9.88131e-323. Which is collect behavier? This is the same bug as alpha/12623 isn't it? As I recall the analysis there came to the conclusion that the problem occurs when the strtod(3) code generates extremely small denormalized numbers to tweak the conversion and improve the accuracy. It does this by directly twiddling with the bits in the floating point representation of the number. On the i386 (and judging by the NetBSD code, most other CPU's) this is fine. On the alpha it works most of the time... I did have a go at writing a strtod(3) function from scratch without any adjustments like that. It worked basically OK, but couldn't achieve the right degree of accuracy -- it basically lost a decimal place compared to libc strtod(). I can make that code available if any one is interested, but as it's sitting on my home box, you'll have to wait until this evening. Matthew -- Certe, Toto, sentio nos in Kansate non iam adesse. Dr. Matthew Seaman, Inpharmatica Ltd, 60 Charlotte St, London, W1P 2AX Tel: +44 171 631 4644 x229 Fax: +44 171 631 4844 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?38C3791F.A2616790>