I believe your problem is due to ambiguous type casting.  Your if statement
tests a DOUBLE against a STRING.  Try:

        settype($high_distance, "string");
        settype($low_distance, "string");

Or add this line to your code to see what I'm talking about:
echo "High distance ".gettype ($high_distance)." $high_distance<BR>";
echo "Low distance ".gettype ($low_distance)." $low_distance<BR>";

Will show that $high_distance and $low_distance are of type DOUBLE.

I'm not sure how this will affect your calculation, but the if condition
will at least evaluate to TRUE when $high_distance or $low_distance ==
"INF", you can try to remove the quotation marks, it didn't work for me
though.  The only way I could get it to work was by changing the type.

Maybe your could change your if condition:
if(gettype($variable_name)=="DOUBLE"){ . . .

Hope this helps!
Robert Zwink

-----Original Message-----
From: Hugh Danaher [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 05, 2001 3:46 PM
To: Php-General
Subject: [PHP] negative infinity is unreachable


I have been trying variations of the code posted below with little success.
The log() function generates a -INF statement when trying to calculate the
log of zero or the log of an empty value in the associative array.  With the
"IF then unset() " statements in place, the total contents of log_high[] and
log_low[] arrays become empty.  Without the "IF then unset()" statements the
arrays are full but the program times out because it can't use INF in
imageline().  I've gone through various rewrites on this code block but have
come up with nothing that works, and I need professional help (but that's a
different story).


Failing code:

for ($year=($current_year-5);$year<=($current_year+1);$year++)
     if ($high_distance=="INF")                               / / INF is a
      if ($low_distance=="INF")
     if (isset($high_distance) and isset($low_distance))




PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to