l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2007 Jan 26 12:09

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] location of DBL_EPSILON definition
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] location of DBL_EPSILON definition

On Fri 26 Jan 07, 11:46 AM, Micah Cowan <micah@cowan.name> said:
> On Fri, 2007-01-26 at 14:36 -0500, Peter Jay Salzman wrote:
> > On Fri 26 Jan 07,  8:39 AM, Micah Cowan <micah@cowan.name> said:
> > > My float.h simply defines DBL_EPSILON to __DBL_EPSILON__. There does not
> > > appear to be an inclusion of some other file, or a definition of
> > > __DBL_EPSILON__. So the answer to your question would seem: compiler
> > > magic. :)
> >  
> > This is very unfortunate.  I liked having one file to look at for all my
> > float constant curiosity.
> In that case, you could try one of the following:
>      1. Write a simple C program that prints out, to the maximum useful
>         precision, the values you're interested in. Actually, chances
>         are you could use C preprocessing stringization to get /exactly/
>         the values used.
>      2. The preprocessor seems to translate the magic __DBL_EPSILON__
>         (rather than the compiler proper); therefore, running gcc -E on
>         a file like:
> #include <float.h>
> gives (for me):
> # 1 "test.c"
> # 1 "<built-in>"
> # 1 "<command line>"
> # 1 "test.c"
> # 1 "/usr/lib/gcc/i486-linux-gnu/4.1.2/include/float.h" 1 3 4
> # 2 "test.c" 2
> 2.2204460492503131e-16
> --------
> ...for method #1, above, you could do something like:
> #include <float.h>
> #include <stdio.h>
> #define STR2(x) #x
> #define STR(x) STR2(x)
> int main(void) {
>     printf("DBL_EPSILON: %s\n", STR(DBL_EPSILON));
>     /* ... etc ... */
>     return 0;
> }

I understand all that, in fact I used option #1 two nights ago (option #2 is
pretty clever, btw).  But it still doesn't change fact:

This is very unfortunate.  I liked having one file to look at for all my
float constant curiosity.

I'll even add:

It's unfortunate that I have to do *anything* other than to type the words
"less <file>".  :(


How VBA rounds a number depends on the number's internal representation.
You cannot always predict how it will round when the rounding digit is 5.
If you want a rounding function that rounds according to predictable rules,
you should write your own.
              -- MSDN, on Microsoft VBA's "stochastic" rounding function

Peter Jay Salzman, email: p@dirac.org web: http://www.dirac.org/p    
PGP Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.