🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #768

Re: float precision

#768
From: Dieter Buerssner
Date: Thu, 13 Apr 2000 00:00
22 lines
1760 bytes
dataman@cyberdude.com wrote:

>I need to define a world of 10 000 000 units .  I need to use float for
>that . I think to use only the positive part (but will depend from the
>answer of my question).
>What precision (after the dot ) can i expect  ?

The header <float.h> defines FLT_EPS, DBL_EPS and LDBL_EPS.
These numbers mean, that a value that is FLT_EPS larger than one,
is representable as a distinct floating point value of type float. 
So these values can be identified with the precision of the 
corresponding floating point type.

Most modern systems use IEEE floating point. For type double,
DBL_EPS will be 2^-53 = 1.1e-16. This means, that you have about
16 significant digits. For values around 1e7, 7 digits will be consumed
before the decimal point. So you can expect 9 significant digits
"after the dot". For type IEEE float you can't expect any significance
after the decimal point at all for 1e7.

-- 
Regards, Dieter
Technical Details
Message-ID: <8d52jr.3vvrn3d.0@buerssner-17104.user.cis.dfn.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <38F5D7E6.153591F2@cyberdude.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fdcad,fcf1bc31a1ccc99f
X-Google-Attributes: gidfdcad,public
X-Google-Thread: 109fba,fcf1bc31a1ccc99f
X-Google-Attributes: gid109fba,public
X-Google-Thread: 114592,fcf1bc31a1ccc99f
X-Google-Attributes: gid114592,public
From: buers@gmx.de (Dieter Buerssner)
Subject: Re: float precision
Date: 2000/04/13
Message-ID: <8d52jr.3vvrn3d.0@buerssner-17104.user.cis.dfn.de>
X-Deja-AN: 610720296
Content-Transfer-Encoding: 8bit
References: <38F5D7E6.153591F2@cyberdude.com>
X-Posting-Agent: Hamster/1.3.13.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: fu-berlin.de 955642191 7503799 149.225.1.36 (16 [17104])
Mime-Version: 1.0
User-Agent: Xnews/03.02.04
Newsgroups: alt.comp.lang.learn.c-c++,comp.lang.c++,fr.comp.lang.c++