

Efficient float32 arithmetic in JavaScript - vodkq
https://blog.mozilla.org/javascript/2013/11/07/efficient-float32-arithmetic-in-javascript/

======
mistercow
>Float32 operations often require less CPU cycles as they need less precision.

I guess that's true on mobile platforms? My understanding is that on modern
desktop CPUs, the only time double precision takes more CPU cycles is if
you're doing SSE (since you can't fit as many doubles into an SSE register).

And I suppose in _some_ contexts where you have to compute a value
iteratively, you'd have to do more iterations to get full precision out of a
double. But the situations where you really care about having an actual
float32 instead of simply letting the trailing bits of the float64 be
incorrect are relatively rare.

~~~
carterschonwald
For CPU instructions yes, but for derived operations that are usually running
a few steps of a newton methor or taylor series, those probably converge
faster to Float32 precision than Float64 precision

~~~
mistercow
Right, that was what I was saying in my second part. But they won't reach 32
bits of precision faster (they might actually reach it faster with float64,
since each step is more precise). And if you only need 32 bits of precision,
there's not much difference between accepting 32 extra wrong bits, and
rounding the number down to 32 bits.

~~~
carterschonwald
Good point. Are there any good examples that show case this?

