Original Post
🔒 Locked
Float or Double
Advertisement
The FPU should handle floats and doubles at the same speed. It''s the extra size (read: memory bandwidth used) that causes the difference. When using SIMD instructions, twice as many floats can be processed as doubles.
I agree with Cedric... you most likely won''t need the added precision. Try it out. If you get precision problems, you can always switch to doubles. I''d recommend a simple:
Use real_t everywhere. If you find the need to use extra precision, all you need to do is change the typedef.
I agree with Cedric... you most likely won''t need the added precision. Try it out. If you get precision problems, you can always switch to doubles. I''d recommend a simple:
typedef float real_t;
Use real_t everywhere. If you find the need to use extra precision, all you need to do is change the typedef.
AFAIK, the FPU converts from 32bit (or 64bit) to a standard precision (80bit on Intel processors, 64bit on some, though not all, AMD processors) and converts back upon storing. The multiplication is done entirely using those registers, taking 3 clock ticks. Funnily, depending on the state of the floating point control word, division does take a different number of ticks for each precision (19 ticks for 24bit precision, 33 ticks for 53bit precision, 39 ticks for 64bit precision)
These timings are for Pentium/Pentium MMX. The situation is analogous (if a little more complicated) for more recent processors.

[edited by - Kippesoep on November 6, 2002 11:06:52 AM]
These timings are for Pentium/Pentium MMX. The situation is analogous (if a little more complicated) for more recent processors.

[edited by - Kippesoep on November 6, 2002 11:06:52 AM]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement