Jump to content

Problem in my computation result Infinity


newphpcoder

Recommended Posts

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

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.)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.