A question about what variable type is faster....
Well, doubles are 8 byte(64bit), and floats are only 4 bytes(32bits), though floating point math is done on the FPU and is generally slower. Id say that on Newer CPU''s(espically the K7, Athlon) the floats would be faster. Though on VERY old CPU''s, like 386, Integer(doubles) would be faster. Just an Educated guess though, Maybe you should wait for someone else to post a definite answer
Doubles are floating point values too. Longs are integers.
Floats are typically faster since the FPU is usually set to lower precision....
Floats are typically faster since the FPU is usually set to lower precision....
Depends on the processor.
Pentium Pros are always in 128bit comp, with 64bit results mode.
The FPU converts to from float, double to long doubles depending on the op code used - which is faster than calling an explicit op code or two to do the conversion yourself.
Unless they added the mode switch to PII''s & PIII''s they are the same.
If you had 4 double & 4 floating calculations to do the doubles would be faster. If you have more than that, the floats would be faster. Its complicated, but generally floats & longs are the fastest.
All of the 3D hardware I''ve used & seen uses floats, so you want the results in their native format to prevent needless conversions. If the 3D engine was entirely software, a stategic mix of longs & floats would be the fastest because Ppros & beyond can actually super-scale int & floating operations (or so the intel documents claim ) the Pro has 2 integer pipes & 2 floating pipes. I think the PIII''s & Athelons have of 4 of each but have been unable to locate the damn architecture docs... so I don''t know.
-Magmai Kai Holmlor
I am brazen and fear no flames.
(So long as I don't lose this Ring of Fire Protection +5)
Pentium Pros are always in 128bit comp, with 64bit results mode.
The FPU converts to from float, double to long doubles depending on the op code used - which is faster than calling an explicit op code or two to do the conversion yourself.
Unless they added the mode switch to PII''s & PIII''s they are the same.
If you had 4 double & 4 floating calculations to do the doubles would be faster. If you have more than that, the floats would be faster. Its complicated, but generally floats & longs are the fastest.
All of the 3D hardware I''ve used & seen uses floats, so you want the results in their native format to prevent needless conversions. If the 3D engine was entirely software, a stategic mix of longs & floats would be the fastest because Ppros & beyond can actually super-scale int & floating operations (or so the intel documents claim ) the Pro has 2 integer pipes & 2 floating pipes. I think the PIII''s & Athelons have of 4 of each but have been unable to locate the damn architecture docs... so I don''t know.
-Magmai Kai Holmlor
I am brazen and fear no flames.
(So long as I don't lose this Ring of Fire Protection +5)
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
the new proccessors (PII+ and k6II+) convert floats (32-bit) to doubles (64-bit) for their internal fpu calculations, so i would say that the speed is almost the same (excpet that float needs ot be converted everytime)
if you don''t care about the memory usage (since double takes twice as much ad float) use double (better precission)
but if you want your program to allocate less memory (i mean if you''re gonna be storing the coordinates for 50000 vertices in memory) then just use a float. it costs less memory
----------------
- Pouya / FOO!!!
***CENSORED***
if you don''t care about the memory usage (since double takes twice as much ad float) use double (better precission)
but if you want your program to allocate less memory (i mean if you''re gonna be storing the coordinates for 50000 vertices in memory) then just use a float. it costs less memory
----------------
- Pouya / FOO!!!
***CENSORED***
All x86 CPU (since 8087 coprocessor) convert floats, doubles, integers, etc. to internal 80bit format. This conversion is "free" for floats and doubles.
Precision of internal calculations depend on FPU control register. By default it''s set to 64bit (double).
Performance on the simple operations (+- and *) is the same for floats and doubles.
Pentium/MMX: 3/1 (result after 3 cycles, may start new operation on each new cycle)
PPro,PII,PIII: (+-) : 3/1, (*) : 5/2 (cannot start new fmul one cycle after previous)
K6/-x: 2 (not pipelined)
K7 (Athlon): 4/1
Division and sqare root are slower for double internal precision.
(for example, on PII/PIII fdiv takes 18 cycles for float and 32 cycles for double)
Also floats are smaller and more cache & memory friendly.
And you can use integer operations to do some tricks with floats - like fast comparison.
Precision of internal calculations depend on FPU control register. By default it''s set to 64bit (double).
Performance on the simple operations (+- and *) is the same for floats and doubles.
Pentium/MMX: 3/1 (result after 3 cycles, may start new operation on each new cycle)
PPro,PII,PIII: (+-) : 3/1, (*) : 5/2 (cannot start new fmul one cycle after previous)
K6/-x: 2 (not pipelined)
K7 (Athlon): 4/1
Division and sqare root are slower for double internal precision.
(for example, on PII/PIII fdiv takes 18 cycles for float and 32 cycles for double)
Also floats are smaller and more cache & memory friendly.
And you can use integer operations to do some tricks with floats - like fast comparison.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement