Ganbree Posted January 13, 2007 Share Posted January 13, 2007 In a simple script im dividing to very differant numbers,problem come from the exponents it can create:$var1 = $num1 / $num2 * 0.01; // 0.01 is a constant answer = 8.14947503631E-06if($var1 < 0) {$var1 = 0;}problem...$var1 still equals 8.14947503631E-06is a exponent stored as a string and is being compared to 0,i couldnt find a is_exp or is_expo / is_exponant etc... Link to comment https://forums.phpfreaks.com/topic/34024-simple-answer/ Share on other sites More sharing options...
Ganbree Posted January 13, 2007 Author Share Posted January 13, 2007 doh didnt put what I wanted to do:I want the small exponants to be set to 0 and the large exponants set to a 0.025 Link to comment https://forums.phpfreaks.com/topic/34024-simple-answer/#findComment-159938 Share on other sites More sharing options...
kobmat Posted January 13, 2007 Share Posted January 13, 2007 from the code of course $var1 will still be 8.14947503631E-06cause 8.14947503631E-06 is still greater than 0..You should decide until which value you want the $var1 to be set to zerosayif($var1 < 0.00001) $var = 0; Link to comment https://forums.phpfreaks.com/topic/34024-simple-answer/#findComment-159939 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.