Hi there,
I am having trouble getting a math function to add to currency values together.
The issue is the rounding, here is a basic example. var c is returning 3761 and it should be 3762.38
I have played with a lot of examples but can't get it working. Is there a simple method out there to achieve the correct calculation?
Thanks for looking.
I am having trouble getting a math function to add to currency values together.
The issue is the rounding, here is a basic example. var c is returning 3761 and it should be 3762.38
I have played with a lot of examples but can't get it working. Is there a simple method out there to achieve the correct calculation?
Thanks for looking.
Code:
<html>
<head>
</head>
<body onLoad="calcvals()">
<script language="JavaScript">
function calcvals(){
var a = '3145,8'
var b = '616,58'
var c = parseFloat(a) + parseFloat(b)
alert(c)
}
</script>
</body>
</html>