Date: Mon, 6 Mar 2000 12:15:53 +0200 (EET) From: Narvi <narvi@haldjas.folklore.ee> To: Matthew Seaman <m.seaman@inpharmatica.co.uk> Cc: Nobuhiro Yasutomi <nobu@rd.isac.co.jp>, 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: <Pine.BSF.3.96.1000306121331.13688C-100000@haldjas.folklore.ee> In-Reply-To: <38C3791F.A2616790@inpharmatica.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 6 Mar 2000, Matthew Seaman wrote: > 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... > It works, but you must be in -mieee mode. Otherwise the behaviour is undefined. If you want denormals, etc. to work, you must have ieee fpu. Without -mieee you get flush to zero. > 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 That is probably to be expected. Sander > 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?Pine.BSF.3.96.1000306121331.13688C-100000>