float or int
Hy,
I was wondering, do I have to use floats or ints for my objects coordinates. Float will have more presision but and is faster, except for the rasterization. int will be faster when rasterizing. Which performance loss will be most important and should I ignore ...
thanx,
1c4i4
if you''re that worried about speed, use a 32 bit int(assuming you''re on a 32 bit machine).. or if you really need a fractional value, use fixed point
whats your target?
I''m guessing some sort of pentium... floats are faster than ints in a lot of places...
ints are fast if its an older system (486,386,ect).
rast will be the biggest performace hit... alot more calculating than movement and the like...
also is it 3d or 2d? I personaly use ints for 2d and floats for 3d
Great Milenko
I''m guessing some sort of pentium... floats are faster than ints in a lot of places...
ints are fast if its an older system (486,386,ect).
rast will be the biggest performace hit... alot more calculating than movement and the like...
also is it 3d or 2d? I personaly use ints for 2d and floats for 3d
Great Milenko
Words Of Wisdom:
"Never Stick A Pretzel In Your Butt It Might Break Off In There."
http://www.crosswinds.net/~milenko
http://www.crosswinds.net/~pirotech
The Great Milenko"Don't stick a pretzel up your ass, it might get stuck in there.""Computer Programming is findding the right wrench to hammer in the correct screw."
thanx huys,
I am speeking 2D right now. But thanx for the info to use floats when programming 3D stuff. Does anyone of you know how big the performance loss is when converting floats to ints on Pentium machines.
1c4i4
I am speeking 2D right now. But thanx for the info to use floats when programming 3D stuff. Does anyone of you know how big the performance loss is when converting floats to ints on Pentium machines.
1c4i4
The performance loss is a big issue when converting floats to ints on pentiums... however there are workarounds.
If you can deal with only using 23 bits of the float for the int instead of all 32, you can just add
8388608.0f to the and mask off the upper 9 bits. this will just about double the speed of using a standard type cast.
If you can deal with only using 23 bits of the float for the int instead of all 32, you can just add
8388608.0f to the and mask off the upper 9 bits. this will just about double the speed of using a standard type cast.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement