I am having some problems with how round php numbers and javascript are. I am using a PHP round function and this javascript function:
function roundNumber(number, decimals) { var newnumber = new Number(number+'').toFixed(parseInt(decimals)); var value = parseFloat(newnumber); return value; }
The number I'm trying to round is 43.65 * 2.5 + 40% when this is done using the calculator = 152.775 or when rounding in PHP = 152.78.
In javascript, when I do console.log, the number is 152.774999999998 and when rounding off with the function above gives me 152.77
Any help in spreading this issue is much appreciated
source share