ngobw
asked on
Javascript anomaly calculating sum of numbers.
This script boggles me. When the numbers are added, it seems that it doesn't amount to 100, but instead gave a value of 100.000.... 001
Can anyone explain to me why this is so? Thanks!
NOTE: Substitute the plus sign before testing it.
Can anyone explain to me why this is so? Thanks!
NOTE: Substitute the plus sign before testing it.
<html>
<head>
<script type='text/javascript'>
function holygrail() {
sum = 51.4 'plus' 14 'plus' 14 'plus' 11.4 'plus' 7.5 'plus' 1.7;
alert(sum);
}
</script>
</head>
<body onload='javascript:holygrail();'>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER