From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <99a67247ca7b81245f609d3f68a4cd21@quanstro.net> From: erik quanstrom Date: Thu, 30 Jul 2009 09:25:00 -0400 To: 9fans@9fans.net In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] ape strtod crash Topicbox-Message-UUID: 320475e4-ead5-11e9-9d60-3106f5b1d025 On Thu Jul 30 08:18:45 EDT 2009, rogpeppe@gmail.com wrote: > 2009/7/30 erik quanstrom : > > fixed, > > > > http://9fans.net/archive/2009/01/234 > > ok, thanks, i had a very vague memory of this, but obviously > my googling was inadequate. > > did you submit a patch? i can't see one. > i will if not - it's an annoying error. i'm sorry. i wasn't sure this patch met the standards, and then i forgot about it. i've found that patches like this are hard to go far enough yet not go too far. /n/sources/patch/apestrtod. here's a demonstration of the fix. awk is sufficient to demonstrate the problem with the number you mention. ; echo 421567849e316 | /n/sources/plan9/386/bin/awk '{print}' 421567849e316 ; 9fs sources ; ; echo 421567849e316 | /n/sources/plan9/386/bin/awk '{print}' /n/sources/plan9/386/bin/awk: floating point exception 6 source line 1 > > (and, as you say, why not just use the usual strtod?) > a partial answer is in /sys/src/ape/lib/fmt/strtod.c's comments. there are cases were ERANGE is appropriate in unix land. this is the hard question. perhaps dumping ape stdio's strtod and editing the usual one to fit unix's model would be the right plan. - erik