Kevin
Floating point vs. Interger
Admin for GameDev.net.
With today's hardware, there's very little need to do fixed point anymore. It's not worth the trouble.
I mean even if you could make a fixed point math library that was slighly faster than a floating point one, the extra code and development effort you'd spend getting around precision errors would cause a lot of pain and wasted time.
------------------
-vince
the only time i really used fixed point agressively was in a bitmap scaling routine (written in asm), where subpixel coordinates had to be converted to screen coordinates, which only required a bit shift. I don't think it would have been as fast using floating point numbers, and rounding them every pixel!
However, if you are thinking of doing conversions between types then definately be careful about how often and where you do them, they can account for a lot of processor speed.
The pentium does have a separate FP module which makes floating point instructions execute in parallel. However, if you are going to be accessing the FP variables often your best bet is to use fixed point math.
There are certain situations for everything and there is no "right" answer all of the time. The trick is to time your code and test out your theories. Something that somebody tells you is useless may give you that extra speed-up you need.
For example, I have a floor/ceiling mapper in my current game. I converted it to Fixed point and I was rewarded with a frame rate increase of almost 3x. Yet, I -re-coded the rest of the enging to use fixed point and I didn't receive even a 1 FPS increase. The reason, I wasn't accesing the values often enough for it to matter.
If I would have never tried it out, then I would have missed out on that great speed improvement. It is your call. Personally, I never pay much attention to what people tell me will/won't work ...I tru for myself and see.
- Chris
2x, 3x slower or what?
UraniumRod
It seem to me that rendering code is usually fastest as fixed-point, since screen coordinates always need to be integers, but the more high-level code can remain floating-point. Like what Chris said.
------------------
~CGameProgrammer( );