swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Negative double weirdness


From: Steve Emsley
Subject: Re: Negative double weirdness
Date: Mon, 29 Jun 1998 20:14:28 +0100

>>>>> "Marcus" == Marcus G Daniels <address@hidden> writes:

    Marcus> Is this just in probe displays or does the arithmetic get
    Marcus> screwed up if you printf the values as well?

Marcus,

All those figures came from printf statements ... that's where the
real weirdness comes in!

The more I delve into this the stranger it becomes - although I bet
it'll end up being something trivial highlighting some embarrassing
gap in my knowledge of C/ObjC.

The error enters with the statement:

      rad *= pow(trans, airmass);

aahh - I have attained satori.

'trans' can be 0.0 and pow() returns a domain error if base is
zero. So I guess it returns errno which seems to be a negative
integer and, hence, my rad goes negative.

O.K. I've sorted that out but how come version 1.1 ignored the error
while version 1.2 also ignored the error BUT returned errno. I'd have
expected a runtime error to stop the program.

Oh, well, better check all my other uses of pow().
Steve.
-- 
---------------------------------------------------------------------
 Steve Emsley                 Ecosystems Analysis & Management Group
 address@hidden              University of Warwick, England
 http://www.oikos.warwick.ac.uk/~sme/           (+44) (0)1598 753648
---------------------------------------------------------------------

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]