
how to store stuff in floats
lo all, ive got a question about floats thats bothering me :s i was wondering what sort of range i can store in a float and with what accuracy... say i have an engine where 1.0 is a kilometre, and 0.001 is a meter and i need accuracy to one meter. what would be the maximum size of the world? i know its a trade-off between size and accuracy but dont know much else :> any help would be greatly appreciated
Fusi0n
"We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle

http://fusi.basscut.net"We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle
Common now, a trivial Google search or even a browse through MSDN would yield your answer...
The maximum value for float is 3.402823466 x 1038, with 6 decimal digits of precison. Go here for additional specs.
The maximum value for float is 3.402823466 x 1038, with 6 decimal digits of precison. Go here for additional specs.
You could allways use long's... 2147km with a resolution of 1mm :D
[edited by - Tjoppen on October 26, 2002 11:30:39 AM]
[edited by - Tjoppen on October 26, 2002 11:30:39 AM]
delete this;
cheers
didnt think of googlin it :D
ill have a look at longs as well
ta, Fusi0n
"We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle

ill have a look at longs as well

ta, Fusi0n
"We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle
http://fusi.basscut.net"We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle
"IEEE 754" is the magic search term.
"What Every Computer Scientist Should Know About Floating-Point Arithmetic" :
http://docs.sun.com/source/806-3568/ncg_goldberg.html
--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com
"What Every Computer Scientist Should Know About Floating-Point Arithmetic" :
http://docs.sun.com/source/806-3568/ncg_goldberg.html
--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site
If I''m not mistaken about the OP''s question, the maximum size of a float isn''t what he''s interested in. If you ever use a point in the world around, say, 2e30 you wouldn''t have any precision at all. I don''t feel like counting now, but the smallest point would probably be around a few km.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement