9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] float overflow
@ 2010-03-26 11:58 hugo rivera
  2010-03-26 12:43 ` erik quanstrom
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: hugo rivera @ 2010-03-26 11:58 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello,
float operations are causing me some headaches on plan 9 (9vx).
I have a program that crashes badly when I feed it with near-the-top
doubles ~1.1e308. This causes an overflow in a function that needs to
square this values and acid points the line where the first call to
pow(2) occurs when I debug it. The problem is that this doesn't happen
at all when the program is compiled with gcc (9c) on linux. Obviously
my results aren't useful, but I get '+Inf' on my output and the
program doesn't crash. I thought of using isInf(2) to avoid Infs in my
operations, but this would make the code really ugly and probably
slow.
I've seen that hoc also suffers from this. On 9vx

% echo 1.75e308+1.75e308 | hoc
hoc 851: suicide: sys: trap: 19 (reserved) pc=0x00003a75

but on linux

echo 1.75e308+1.75e308 | hoc
+Inf

is there something I can do to remedy this situation? maybe this
doesn't happen on a native plan 9 installation, but I don't have
access to any.
Saludos,

--
Hugo



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-03-26 20:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-26 11:58 [9fans] float overflow hugo rivera
2010-03-26 12:43 ` erik quanstrom
2010-03-26 12:44 ` maht
2010-03-26 12:54 ` Federico G. Benavento
2010-03-26 13:37   ` hugo rivera
2010-03-26 16:44 ` ron minnich
2010-03-26 16:57   ` hugo rivera
2010-03-26 17:01     ` erik quanstrom
2010-03-26 17:05     ` ron minnich
2010-03-26 17:05       ` ron minnich
2010-03-26 17:22         ` hugo rivera
2010-03-26 17:46       ` Tim Newsham
2010-03-26 20:23         ` ron minnich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).