Skip to main content
gamedev.net
🔒 Locked

float V double

Started by Jimfing 5 replies 200+ views
Original Post
Jimfing
Jimfing
Is there a significant speed difference between using floats and doubles on modern intel/AMD processors? cheers jim
civguy
civguy
Try it out. Just make two simple loops with some calculations (one for floats, one for doubles) and print the time they took.
Jan Wassenberg
Jan Wassenberg
1) all operands are converted to 80 bit extended format
2) doubles are 2x as big => more memory pressure
3) speedwise, the only difference is FPU precision: double fdivs and fsqrts are ~25% (estimate) slower.

civguy: Zimbabwe? Did''t it use to be ''somewhere in northern europe''?
E8 17 00 42 CE DC D2 DC E4 EA C4 40 CA DA C2 D8 CC 40 CA D0 E8 40E0 CA CA 96 5B B0 16 50 D7 D4 02 B2 02 86 E2 CD 21 58 48 79 F2 C3
Ready4Dis
Ready4Dis
You can use getClockTicks, or clock(), or QuerryPerformanceTimer... or anything else you''d like to use. The longer you let it run (more iterations) the more accurate your results will be .
aidan_walsh
aidan_walsh
As I don''t know C++ I can only give you the psuedocode:

-Record the current system time in milliseconds
-Run a loop with the calculation a known number of times
-Again, record the number of milliseconds
-Subtract the start time from the end time and divide by the number of loops
-This will give you the time taken to perform one calculation



#Old Steve, he said to Xerox "Boys, turn your heads and cough"
And when no-one was looking he ripped their interfaces off#
Three Dead Trolls in a Baggie on the truth behind MacOS 1

SketchSoft | SketchNews


www.aidanwalsh(.net)(.info)
civguy
civguy
quote:
Original post by Jan Wassenberg
civguy: Zimbabwe? Did''t it use to be ''somewhere in northern europe''?

Sshh.. They might be watching

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.