Hacker News new | ask | show | jobs
by grimboy 5025 days ago
Why would you post a link to an example using floats then? I mean sure, part of the trick involves treating the float as an integer but the number is still meant to be interpreted as a float.

Your assumptions about speed might be true for something like a Nintendo DS which doesn't have a floating point unit but a 3DS does, a vectorised one no less. Also in Javascript integers that can fit into 32 bits are actually integers nowadays.

All in all, I believe your information is outdated.

2 comments

Not to mention that most modern games and physics engines all use floating point numbers these days. We're not in the 90's anymore - gpu's all support floats natively and are very fast at processing them, cpu floating point units are as fast as integer units, SIMD (eg SSE) supports fast floats and doubles. There's really no reason to avoid floats unless you're doing something very very special (hint: if you're arguing about these things, you're probably not).

Havok, Bullet, PysX - as far as I know they all use floats.

Without tests at first glance I might be having false asssumptions on modern JS optimisations: NaCl (C) http://juliamap.googlelabs.com... VS http://www.atopon.org/mandel/# does not strikes me as JS being an order of magnitude slower than NaCl.

It looks like I might be very wrong.

I will make my opinion later by calculating decimal of PI or something like that in C and in JS to benchmark.

I think I need to update my knowledge. :)