• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Cannot get simple Javascript math functions to work

Davegod75

Diamond Member
So I'm doing something simple here but not getting the results I am expecting.

var A = 2.599
var B = 12.606

var C = (A * B)

javascript gives me 32.7474
but windows calculator and ever other program in the world gives me 32.762994


what gives? and how do I fix it.

Thanks
 
Javascript is known to work in very low precisions.. although I still don't really understand how that number came about 😕

Have you tried using Math.round() to see if it at least gets it correct up till say 2 decimal points?
 
Back
Top