Article View: alt.comp.lang.learn.c-c++
Article #761Re: float precision
From: Lawrence Kirby
Date: Thu, 13 Apr 2000 00:00
Date: Thu, 13 Apr 2000 00:00
33 lines
2241 bytes
2241 bytes
In article <38F5FA5B.813A2438@cyberdude.com> dataman@cyberdude.com writes: >Thanks to all for the fast answers ..... > >Now, i understand why it's called "floating point" ....the precision changes >... No, the precision stays the same (6-7 digits for a typical float). You have 6-7 digits of precision whether your number is very big or very small. > >I need float and not double ...Why ? >I am building a 3d word , a big 3d world ..1000 km x 1000 km with 1 cm >precision (= 100 000 000 units). You could store your coordinates represented as cm. Then you have a number between, say, 0 and 99999999. You can store that in a 32 bit or larger integer such as a long. >In this 3d world all the objects have a Point/Vector position (float x,y,z) >...this is what the 3d engine needs (with relatively good precision)..and >what i would like , is to keep in the abstract world representation. I want >to avoid the conversion between world/3d engine co-ordinates .. You can't have it both ways. float doesn't have the precision so for a floating point type you would need a double. A 32 bit integer does have the necessary precision but you may require some conversion. -- ----------------------------------------- Lawrence Kirby | fred@genesis.demon.co.uk Wilts, England | 70734.126@compuserve.com -----------------------------------------
Technical Details
Message-ID:
<955664508snz@genesis.demon.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<38F5D7E6.153591F2@cyberdude.com> <38F5E510.E33662C@gascad.at> <38F5FA5B.813A2438@cyberdude.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,fcf1bc31a1ccc99f X-Google-Attributes: gid109fba,public X-Google-Thread: fdcad,fcf1bc31a1ccc99f X-Google-Attributes: gidfdcad,public X-Google-Thread: 114592,fcf1bc31a1ccc99f X-Google-Attributes: gid114592,public From: fred@genesis.demon.co.uk (Lawrence Kirby) Subject: Re: float precision Date: 2000/04/13 Message-ID: <955664508snz@genesis.demon.co.uk> X-Deja-AN: 610900824 X-Mail2News-Path: news.demon.net!genesis.demon.co.uk References: <38F5D7E6.153591F2@cyberdude.com> <38F5E510.E33662C@gascad.at> <38F5FA5B.813A2438@cyberdude.com> X-Trace: mail2news.demon.co.uk 955671101 mail2news:26175 mail2news mail2news.demon.co.uk Organization: none Reply-To: fred@genesis.demon.co.uk Newsgroups: alt.comp.lang.learn.c-c++,comp.lang.c++,fr.comp.lang.c++ X-Complaints-To: abuse@demon.net