Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Complex Algorithm returning NaN

Status
Not open for further replies.

MrsMcGuyver

Programmer
Oct 2, 2001
8
0
0
US
I have a fairly complex algorithm returning one of 3 different variables. When the pieces of my equation result in a very tiny number (so tiny it's technically negative for the purposes of my program) I get NaN for a result. I've tried to capture the number & turn it back to 0 to prevent the NaN but I it still translates the NaN. Any help/ideas on what else to try?
 
Interesting.. that must be an incredibly small number... Can you check the result as a string like so:

if ($result eq "NaN") {$result=0;}

just a thought..

Matt.
 
Thanks. I was so wrapped up in the fact that I should have a number the lightbulb didn't go off at a string eq.

Tammy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top