brett
15th January 2004, 18:13
I'm having a problem with not getting enough precision in my frame calculations.
Visual C++ 6.0 only gives me 64-bit long doubles. 29.97 FPS is actually:
29.9700299700299700299700... FPS
but the closest I can get is:
29.9700299700299690 FPS
This becomes a problem when I'm trying to calculate the position of a frame down to 1/1000 sec.
Frame 13005 (29.970 FPS)
actual position = 433.93350 sec
posion reported in VDub = 433.934 sec
posion calculated in C++ = 433.933 sec
Even if I display just the simple calculation:
13005.0 / 30000 * 1001
I should get 433.9335, but it gives:
433.933499999999980.
So, it rounds down. I need to an accurate result to match VDub's calculations.
Visual C++ 6.0 only gives me 64-bit long doubles. 29.97 FPS is actually:
29.9700299700299700299700... FPS
but the closest I can get is:
29.9700299700299690 FPS
This becomes a problem when I'm trying to calculate the position of a frame down to 1/1000 sec.
Frame 13005 (29.970 FPS)
actual position = 433.93350 sec
posion reported in VDub = 433.934 sec
posion calculated in C++ = 433.933 sec
Even if I display just the simple calculation:
13005.0 / 30000 * 1001
I should get 433.9335, but it gives:
433.933499999999980.
So, it rounds down. I need to an accurate result to match VDub's calculations.