+ 1
about float numbers in js?
When I changed the regular float number to float32, it decreased accuracy. why this happened?( line 47) although in the previous line, i've fixed its accuracy https://code.sololearn.com/WWK2BCo5v0Q9/?ref=app
3 Answers
+ 3
They just aren't as accurate
https://code.sololearn.com/W4FirZ6lG1wj/?ref=app
+ 1
Normal javascript numbers are very accurate and float32 arrays have less accuracy then normal js numbers. The point of typed arrays is for efficiency not accuracy.
+ 1
Zachiah sawyer floating numbers in js behave like this:0.1+0.2=0.30000000000000004;
we can use toFixed method to fix them. but when I assign it to float32, lose accuracy. why?