garbage in, garbage out lotte% echo 1.75e308+1.75e308 | hoc hoc 730809: suicide: sys: fp: numeric overflow fppc=0x3004 status=0xb988 pc=0x3a75 lotte%
if you want to keep feeding garbage to your program disable the exceptions see getfcr(2) or http://plan9.bell-labs.com/magic/man2html/2/getfcr setfcr(getfcr()&~(FPINVAL)); feel free to turn division by 0 trap too On Fri, Mar 26, 2010 at 8:58 AM, hugo rivera <uai...@gmail.com> wrote: > 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 > > -- Federico G. Benavento