🔒 Locked
double precision
Advertisement
Original Post
Hi!
Whats is different between double precision and float precision?
Should such a feature (switching between this modes in realtime) implantated in a good engine?
Thanks, Austrian Coder
float is 4 bytes and allows for -2.0E8 to 2.0E8 or something like that and a double is 10 bytes which obviously changes the percise the result is.
A float will round very easy. a double will round but have alot closer to real numbers that humans would figure if the as the number is spread behind the decimal.
a double double is something like 12 bytes. or something?
A float will round very easy. a double will round but have alot closer to real numbers that humans would figure if the as the number is spread behind the decimal.
a double double is something like 12 bytes. or something?
a float or should I say IEEE float is
1 bit is sign
8 bits are the matanis
23 bits are the float point.
it works out to be something like
Sign matanis*float is the value....
and a 10 byte double has something like
1 bit is sign
26 bits are the matanis
53 bits are the float point.
same equation. If I remember the breakdown correctly
1 bit is sign
8 bits are the matanis
23 bits are the float point.
it works out to be something like
Sign matanis*float is the value....
and a 10 byte double has something like
1 bit is sign
26 bits are the matanis
53 bits are the float point.
same equation. If I remember the breakdown correctly
floats have about 6 significant figures of precision while doubles have about twice that.
You might find these helpful:
IEEE Standard 754 Floating Point Numbers
IEEE Float
Qui fut tout, et qui ne fut rien
Invader''s Realm
You might find these helpful:
IEEE Standard 754 Floating Point Numbers
IEEE Float
Qui fut tout, et qui ne fut rien
Invader''s Realm
mantissa?
Brian
Brian
the mantissa is the number before the exponent in scientific notation for example:
6.23512 X 10^31
the 6.23512 is the mantissa and 31 is the exponent
this is really a silly question though look it up on the web...
6.23512 X 10^31
the 6.23512 is the mantissa and 31 is the exponent
this is really a silly question though look it up on the web...
the mantissa is the number before the exponent in scientific notation for example:
6.23512 X 10^31
the 6.23512 is the mantissa and 31 is the exponent
this is really a silly question though look it up on the web...
6.23512 X 10^31
the 6.23512 is the mantissa and 31 is the exponent
this is really a silly question though look it up on the web...
If the above didn''t clarify the difference between floats and doubles, here''s a simpler explanation.
floats are data types that can contain fractional parts of a number, such as 123.456, whereas integers can only store whole numbers such as 123456. I''m sure you already knew that.
floats are 32 bits, or 4 bytes, long, and are acturate to approximately 7 digits. This can be a problem if you want to store data with more precision. Consider the following:
the number 123.456789123, when stored as a float would actually be 123.4568 (approx) - remember it''s only accurate to 7 digits. This is more apparent with largers numbers such as 123456789 - this would be stored as 123456800. You can see that it isn''t really that accurate. That''s where doubles come into play.
doubles are stored in 64 bits, or 8 bytes, and are accurate to 15 digits. so the number 123.456789123 would be stored correctly. Likewise would the number 123456789.
That''s all the is too it.
Regards
PS - I should tell you that all calculations in the CPU are done as doubles, then rounded down to floats (if using a float data type) when storing back in memory, so there is no speed difference from the CPU''s point of view. However, because doubles take up twice as much memory, it takes slightly longer to get the data from memory into the CPU.
floats are data types that can contain fractional parts of a number, such as 123.456, whereas integers can only store whole numbers such as 123456. I''m sure you already knew that.
floats are 32 bits, or 4 bytes, long, and are acturate to approximately 7 digits. This can be a problem if you want to store data with more precision. Consider the following:
the number 123.456789123, when stored as a float would actually be 123.4568 (approx) - remember it''s only accurate to 7 digits. This is more apparent with largers numbers such as 123456789 - this would be stored as 123456800. You can see that it isn''t really that accurate. That''s where doubles come into play.
doubles are stored in 64 bits, or 8 bytes, and are accurate to 15 digits. so the number 123.456789123 would be stored correctly. Likewise would the number 123456789.
That''s all the is too it.
Regards
PS - I should tell you that all calculations in the CPU are done as doubles, then rounded down to floats (if using a float data type) when storing back in memory, so there is no speed difference from the CPU''s point of view. However, because doubles take up twice as much memory, it takes slightly longer to get the data from memory into the CPU.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement