I'm having trouble having the correct result. Below is my code
function Funtpcal() {
var consiz = document.getElementById("consiz").value;
var cmsn = document.getElementById("cmsn").value;
var x = document.getElementById("tp_vol").value;
var y = document.getElementById("tp_op").value;
var w = document.getElementById("tp_tp").value;
var z = -(((cmsn-100000)*(y*consiz*x))+(100000*w))/((cmsn+100000)*consiz*x);
document.getElementById("tp").innerHTML = z.toFixed(3);
}
<input type="number" id="consiz" value="1000">
<input type="number" id="cmsn" value="1">
<input type="number" id="tp_vol" value="11.35">
<input type="number" id="tp_op" value="110">
<input type="number" id="tp_tp" value="100">
<input type="button" onclick="Funtpcal()" value="Calculate">
<span id="tp"></span>
Correct result is 109.989 as if you were to do this
var z = -(((1-100000)*(110*1000*11.35))+(100000*100))/((1+100000)*1000*11.35);
So tell me what is going wrong