Re: [vox-tech] location of DBL_EPSILON definition

2007-01-29 Thread Boris Jeremic
but then you might be getting a genetically modified one, which might be 
dangerous (?!).


just joking, I am attaching old fashioned float.h to this message

Boris
P.S. in that IEEE 754, you can see the answer to why and not only what are those 
numbers as they are... and also what are the consequences  of what they are...

Peter Jay Salzman wrote:

I already know the names of all my constants and what they mean.  I wanted a
file that I could open and peek at numerical values.  No gcc, no web
browser.  Just some float.h that I can open with vim, less, or grep to
quickly get a value in 2 seconds.

Such a float.h used to exist on my hard drive.  I guess that changed with
some gcc update.

Telling me to read the IEEE 754 standard is like telling me that I need to
know the DNA sequence for a Fuji apple when all I really want is to eat one.

Peter



On Mon 29 Jan 07,  8:58 AM, Boris Jeremic [EMAIL PROTECTED] said:


Then you need to read IEEE 754 (and accompanying documents...):


http://grouper.ieee.org/groups/754/


Boris


Peter Jay Salzman wrote:


On Fri 26 Jan 07,  9:04 AM, Boris Jeremic [EMAIL PROTECTED] said:



on my machine (fedora core 5) there are definitions in

./usr/lib/gcc-lib/i386-redhat-linux/3.2.3/include/float.h

/* Difference between 1.0 and the minimum double greater than 1.0 */
#undef DBL_EPSILON
#define DBL_EPSILON 2.2204460492503131e-16



but not in

./usr/lib/gcc/i386-redhat-linux/4.1.0/include/float.h

where it appears as:

/* The difference between 1 and the least value greater than 1 that is
representable in the given floating point type, b**1-p.  */
#undef FLT_EPSILON
#undef DBL_EPSILON
#undef LDBL_EPSILON
#define FLT_EPSILON __FLT_EPSILON__
#define DBL_EPSILON __DBL_EPSILON__
#define LDBL_EPSILON__LDBL_EPSILON__




It's in neither place for me.




You can also calculate them yourself:



Yeah, I'm aware of that, but this is not what I wanted.

It's not DBL_EPSILON that I care about (I simplified my question).  I 
wanted

a file that I could look at and know any of the constants that are of
interest to me.  It's not one constant I wanted to know, but all of them, 
in

one place.


___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] location of DBL_EPSILON definition

2007-01-29 Thread Boris Jeremic



Peter Jay Salzman wrote:

I already know the names of all my constants and what they mean.  I wanted a
file that I could open and peek at numerical values.  No gcc, no web
browser.  Just some float.h that I can open with vim, less, or grep to
quickly get a value in 2 seconds.

Such a float.h used to exist on my hard drive.  I guess that changed with
some gcc update.

Telling me to read the IEEE 754 standard is like telling me that I need to
know the DNA sequence for a Fuji apple when all I really want is to eat one.

Peter



On Mon 29 Jan 07,  8:58 AM, Boris Jeremic [EMAIL PROTECTED] said:


Then you need to read IEEE 754 (and accompanying documents...):


http://grouper.ieee.org/groups/754/


Boris


Peter Jay Salzman wrote:


On Fri 26 Jan 07,  9:04 AM, Boris Jeremic [EMAIL PROTECTED] said:



on my machine (fedora core 5) there are definitions in

./usr/lib/gcc-lib/i386-redhat-linux/3.2.3/include/float.h

/* Difference between 1.0 and the minimum double greater than 1.0 */
#undef DBL_EPSILON
#define DBL_EPSILON 2.2204460492503131e-16



but not in

./usr/lib/gcc/i386-redhat-linux/4.1.0/include/float.h

where it appears as:

/* The difference between 1 and the least value greater than 1 that is
representable in the given floating point type, b**1-p.  */
#undef FLT_EPSILON
#undef DBL_EPSILON
#undef LDBL_EPSILON
#define FLT_EPSILON __FLT_EPSILON__
#define DBL_EPSILON __DBL_EPSILON__
#define LDBL_EPSILON__LDBL_EPSILON__




It's in neither place for me.




You can also calculate them yourself:



Yeah, I'm aware of that, but this is not what I wanted.

It's not DBL_EPSILON that I care about (I simplified my question).  I 
wanted

a file that I could look at and know any of the constants that are of
interest to me.  It's not one constant I wanted to know, but all of them, 
in

one place.


___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech

/* float.h for target with IEEE 32/64 bit and Intel 386 style 80 bit
   floating point formats */
#ifndef _FLOAT_H_
#define _FLOAT_H_
/* Produced by enquire version 4.3, CWI, Amsterdam */

   /* Radix of exponent representation */
#undef FLT_RADIX
#define FLT_RADIX 2
   /* Number of base-FLT_RADIX digits in the significand of a float */
#undef FLT_MANT_DIG
#define FLT_MANT_DIG 24
   /* Number of decimal digits of precision in a float */
#undef FLT_DIG
#define FLT_DIG 6
   /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */
#undef FLT_ROUNDS
#define FLT_ROUNDS 1
   /* Difference between 1.0 and the minimum float greater than 1.0 */
#undef FLT_EPSILON
#define FLT_EPSILON 1.19209290e-07F
   /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */
#undef FLT_MIN_EXP
#define FLT_MIN_EXP (-125)
   /* Minimum normalised float */
#undef FLT_MIN
#define FLT_MIN 1.17549435e-38F
   /* Minimum int x such that 10**x is a normalised float */
#undef FLT_MIN_10_EXP
#define FLT_MIN_10_EXP (-37)
   /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */
#undef FLT_MAX_EXP
#define FLT_MAX_EXP 128
   /* Maximum float */
#undef FLT_MAX
#define FLT_MAX 3.40282347e+38F
   /* Maximum int x such that 10**x is a representable float */
#undef FLT_MAX_10_EXP
#define FLT_MAX_10_EXP 38

   /* Number of base-FLT_RADIX digits in the significand of a double */
#undef DBL_MANT_DIG
#define DBL_MANT_DIG 53
   /* Number of decimal digits of precision in a double */
#undef DBL_DIG
#define DBL_DIG 15
   /* Difference between 1.0 and the minimum double greater than 1.0 */
#undef DBL_EPSILON
#define DBL_EPSILON 2.2204460492503131e-16
   /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */
#undef DBL_MIN_EXP
#define DBL_MIN_EXP (-1021)
   /* Minimum normalised double */
#undef DBL_MIN
#define DBL_MIN 2.2250738585072014e-308
   /* Minimum int x such that 10**x is a normalised double */
#undef DBL_MIN_10_EXP
#define DBL_MIN_10_EXP (-307)
   /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */
#undef DBL_MAX_EXP
#define DBL_MAX_EXP 1024
   /* Maximum double */
#undef DBL_MAX
#define DBL_MAX 1.7976931348623157e+308
   /* Maximum int x such that 10**x is a representable double */
#undef DBL_MAX_10_EXP
#define DBL_MAX_10_EXP 308

   /* Number of base-FLT_RADIX digits in the significand of a long double */
#undef LDBL_MANT_DIG
#define LDBL_MANT_DIG 64
   /* Number of decimal digits of precision in a long double */
#undef LDBL_DIG
#define LDBL_DIG 18
   /* Difference between 1.0 and the minimum long double greater than 1.0 */
#undef LDBL_EPSILON
#define LDBL_EPSILON 1.08420217248550443401e-19L
   /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */
#undef LDBL_MIN_EXP
#define LDBL_MIN_EXP (-16381)
   /* Minimum normalised long double */
#undef LDBL_MIN
#define LDBL_MIN 3.36210314311209350626e-4932L
   /* Minimum int x such that 10**x is a normalised long double */
#undef LDBL_MIN_10_EXP
#define 

[vox-tech] location of DBL_EPSILON definition

2007-01-26 Thread Peter Jay Salzman
Where is DBL_EPSILON defined?  I thought it was in float.h.  But I've looked
at float.h in:

   /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include
   /usr/lib/gcc/i486-linux-gnu/3.4.6/include

and neither one actually defined it.

Where is the numerical value held?
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] location of DBL_EPSILON definition

2007-01-26 Thread Micah Cowan
On Fri, 2007-01-26 at 08:24 -0500, Peter Jay Salzman wrote:
 Where is DBL_EPSILON defined?  I thought it was in float.h.  But I've looked
 at float.h in:
 
/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include
/usr/lib/gcc/i486-linux-gnu/3.4.6/include
 
 and neither one actually defined it.
 
 Where is the numerical value held?

All you really need to worry about is that it gets defined when you
#include float.h.

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. :)

-- 
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/

___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] location of DBL_EPSILON definition

2007-01-26 Thread Peter Jay Salzman
On Fri 26 Jan 07,  8:39 AM, Micah Cowan [EMAIL PROTECTED] said:
 On Fri, 2007-01-26 at 08:24 -0500, Peter Jay Salzman wrote:
  Where is DBL_EPSILON defined?  I thought it was in float.h.  But I've looked
  at float.h in:
  
 /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/include
 /usr/lib/gcc/i486-linux-gnu/3.4.6/include
  
  and neither one actually defined it.
  
  Where is the numerical value held?
 
 All you really need to worry about is that it gets defined when you
 #include float.h.
 
 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.
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] location of DBL_EPSILON definition

2007-01-26 Thread Peter Jay Salzman
On Fri 26 Jan 07, 11:46 AM, Micah Cowan [EMAIL PROTECTED] said:
 On Fri, 2007-01-26 at 14:36 -0500, Peter Jay Salzman wrote:
  On Fri 26 Jan 07,  8:39 AM, Micah Cowan [EMAIL PROTECTED] 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
 DBL_EPSILON
 
 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.  :(

Thanks,
Peter

-- 
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: [EMAIL PROTECTED] web: http://www.dirac.org/p
PGP Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech