ttpparker Posted December 2, 2008 Share Posted December 2, 2008 Im trying to work out a "power to" equation (x to the power of y). I am using the following while loop. while($counter < $TermDays) { $Daily2Worker = $Daily2Worker * $TermDays; $counter = $counter + 1; } This runs 1500 times, the script executes fine but when I output the value $Daily2Worker I get "NaN". If i reduce the number of times the loop runs it works fine. Can anyone help or suggest an alternative way of performing a to the power of calculation. Link to comment https://forums.phpfreaks.com/topic/135124-maxinum-length-of-a-float/ Share on other sites More sharing options...
Mark Baker Posted December 2, 2008 Share Posted December 2, 2008 Im trying to work out a "power to" equation (x to the power of y). I am using the following while loop.Why not just use the pow() function? This runs 1500 times, the script executes fine but when I output the value $Daily2Worker I get "NaN". If i reduce the number of times the loop runs it works fine. Can anyone help or suggest an alternative way of performing a to the power of calculation. Knowing how you initialise the values of $Daily2Worker and $TermDays might also help identify what your specific issue is with what should be a very simple loop Also, your logic will not give you x to the power of y Link to comment https://forums.phpfreaks.com/topic/135124-maxinum-length-of-a-float/#findComment-703857 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.