Old 03-11-2018, 07:19 PM   #1
Time Waster
Human being with feelings
 
Time Waster's Avatar
 
Join Date: Aug 2013
Location: Bowral, Australia
Posts: 1,638
Default A bit of trivia

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.
__________________
Mal, aka The Wasters of Time
Mal's JSFX: ReaRack2 Modular Synth
Time Waster is offline   Reply With Quote
Old 03-12-2018, 10:37 AM   #2
toddhisattva
Human being with feelings
 
toddhisattva's Avatar
 
Join Date: Jun 2008
Location: Austin
Posts: 289
Default U Krekt!

Quote:
Originally Posted by Time Waster View Post
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.
toddhisattva is offline   Reply With Quote
Old 03-12-2018, 05:55 PM   #3
Time Waster
Human being with feelings
 
Time Waster's Avatar
 
Join Date: Aug 2013
Location: Bowral, Australia
Posts: 1,638
Default

If you could use all 64 bits (which I presume you could do it it was just an integer), you could go for over 12 million years!
__________________
Mal, aka The Wasters of Time
Mal's JSFX: ReaRack2 Modular Synth
Time Waster is offline   Reply With Quote
Old 03-12-2018, 10:22 PM   #4
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,688
Default

BTW.: "max out" here means that adding one just does no change, but not that something weired will happen such as throwing an error message or the number becoming a high negative (as would happen with integer).

-Michael. )
mschnell is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:24 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.