*BSD News Article 14656


Return to BSD News archive

Newsgroups: comp.os.386bsd.questions
Path: sserve!newshost.anu.edu.au!munnari.oz.au!spool.mu.edu!agate!dog.ee.lbl.gov!network.ucsd.edu!pacbell.com!amdahl!hip-hop!dfox
From: dfox@hip-hop.suvl.ca.us (David Fox)
Subject: Re: Problems with g++2.3.3 and leda
Keywords: g++2.3.3, leda
References: <1qjd46$vc4@obelix.uni-muenster.de> <1qr1uu$1hck@hal.gnu.ai.mit.edu>
Organization: Hip-Hop BBS, Sunnyvale California
Date: Sun, 18 Apr 1993 18:18:30 GMT
Message-ID: <C5oyuv.AnL@hip-hop.suvl.ca.us>
Lines: 30

mycroft@hal.gnu.ai.mit.edu (Charles Hannum) wrote:
>
>In article <1qjd46$vc4@obelix.uni-muenster.de>
>frido@math.uni-muenster.de writes:
>>
>> After debugging the programm with gdb I found that the line where the
>> exception happens seems quite harmless. It is a comparison of a
>> double variable and zero (double l; if (l==0) ...).
>
>Unfortunately, floating point exceptions are not precise; i.e. the
>processor is not left in the state it was at the time the instruction

This is quite true, of course.  But the earlier poster found something
that isn't exactly harmless.  One should never compare a floating point
value with integer zero.  I suppose one could cast 0 to double so that
a proper set of instructions are generated so that the variable is
compared to 'fldz', but still, the proper way to do it is to compare
the two values within some minimal tolerance.

>-- 
> \  /   Charles Hannum, mycroft@ai.mit.edu
> /\ \   PGP public key available on request.  MIME, AMS, NextMail accepted.
>Scheme  White heterosexual atheist male (WHAM) pride!


-- 
David E. Fox                                   email: hip-hop!dfox@amdahl.com
5479 Castle Manor Drive                   
San Jose, CA 95129                  Thanks for letting me change the magnetic
408/ 253-7992                       images on your hard drive.