Quote:
Originally Posted by Time Waster
For a 64 bit double precision floating point variable, I calculate that if you start from zero and add 1 at every sample, at a sample rate of 48 kHz, you can do that for about 5,946 years before you max out the variable value.
At 2 GHz, you can only go for 52 days.
|
You are correct, sir!
53 mantissa bits gives 2^53 + 1, or 9007199254740992. Put this in a double float and add one, you'll get 9007199254740992.
secs = 9007199254740992.0 / 48000
mins = secs / 60
hours = mins / 60
days = hours / 24
years = days / 365.25
Years = 5946.269186306013
BTW this is why Lua's default numeric type is double float. It's good enough for almost anything.