From owner-freebsd-alpha Mon Mar 6 1:24:21 2000 Delivered-To: freebsd-alpha@freebsd.org Received: from gallions-reach.inpharmatica.co.uk (gallions-reach.inpharmatica.co.uk [193.115.214.5]) by hub.freebsd.org (Postfix) with ESMTP id BCED637BCCD; Mon, 6 Mar 2000 01:24:14 -0800 (PST) (envelope-from m.seaman@inpharmatica.co.uk) Received: from mailhost.inpharmatica.co.uk (euston.inpharmatica.co.uk [193.115.214.6]) by gallions-reach.inpharmatica.co.uk (8.9.3/8.9.3) with ESMTP id JAA80317; Mon, 6 Mar 2000 09:23:44 GMT (envelope-from m.seaman@inpharmatica.co.uk) Received: from paddington.inpharmatica.co.uk (IDENT:root@paddington.inpharmatica.co.uk [192.168.122.1]) by mailhost.inpharmatica.co.uk (8.9.3/8.9.3) with ESMTP id JAA10295; Mon, 6 Mar 2000 09:23:43 GMT (envelope-from m.seaman@inpharmatica.co.uk) Received: from inpharmatica.co.uk (IDENT:matthew@localhost [127.0.0.1]) by paddington.inpharmatica.co.uk (8.9.3/8.9.3) with ESMTP id JAA01585; Mon, 6 Mar 2000 09:23:43 GMT Message-ID: <38C3791F.A2616790@inpharmatica.co.uk> Date: Mon, 06 Mar 2000 09:23:43 +0000 From: Matthew Seaman X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.2.4 i586) X-Accept-Language: en-GB, en MIME-Version: 1.0 To: Nobuhiro Yasutomi Cc: simokawa@sat.t.u-tokyo.ac.jp, gnats-admin@FreeBSD.ORG, freebsd-alpha@FreeBSD.ORG Subject: Re: alpha/17032: strtod(3) floating exception References: <20000306154855R.nobu@rd.isac.co.jp> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Nobuhiro Yasutomi wrote: > > Hidetoshi Shimokawa 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