newphpcoder Posted March 12, 2012 Share Posted March 12, 2012 Hi.. I have this function: function doz(oText){ var P27_max = document.getElementById("P27_max").value; //var P27_max_convert = parseFloat(P27_max) + parseFloat(1); var P27_max_convert = ((parseFloat(P27_max) * parseFloat(1000)) / parseFloat(0.00) / parseFloat(12)); if( !isNaN(P27_max_convert) ){ var P27_maxdoz = document.getElementById("P27_maxdoz").value = P27_max_convert.toFixed(2); } var P28_max = document.getElementById("P28_max").value; // var P28_max_convert = parseFloat(P28_max) + parseFloat(2); var P28_max_convert = ((parseFloat(P28_max) * parseFloat(1000)) / parseFloat(22.00) / parseFloat(12)); if( !isNaN(P28_max_convert) ){ var P28_maxdoz = document.getElementById("P28_maxdoz").value = P28_max_convert.toFixed(2); } } my output is Infinity.. what's wrong in my computation : var P28_max_convert = ((parseFloat(P28_max) * parseFloat(1000)) / parseFloat(22.00) / parseFloat(12)); Thank you Quote Link to comment https://forums.phpfreaks.com/topic/258727-problem-in-my-computation-result-infinity/ Share on other sites More sharing options...
requinix Posted March 12, 2012 Share Posted March 12, 2012 That computation is fine. var P27_max_convert = ((parseFloat(P27_max) * parseFloat(1000)) / parseFloat(0.00) / parseFloat(12)); This one isn't. (And if you're wondering, isNaN() does not check for infinity.) Quote Link to comment https://forums.phpfreaks.com/topic/258727-problem-in-my-computation-result-infinity/#findComment-1326345 Share on other sites More sharing options...
newphpcoder Posted March 13, 2012 Author Share Posted March 13, 2012 Thank you Quote Link to comment https://forums.phpfreaks.com/topic/258727-problem-in-my-computation-result-infinity/#findComment-1326638 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.