Re: Machine epsilon: conclusion
- From: jacob navia <jacob@xxxxxxxxxxxxxxxx>
- Date: Sat, 30 Jun 2007 21:08:41 +0200
Eric Sosman wrote:
jacob navia wrote:Following the discussion about the machine epsilon, I have modified the
text as follows. I thank all people that contributed. It was interesting, and I surely learned stuff I did not consider before.
--------------------------------------------------------------
The machine epsilon
-------------------
The standard defines for each floating point representation (float, double, long double) the difference between 1 and the least value greater than 1 that is representable in the given floating point type. In IEEE754 representation this number has an exponent value of the bias, and a fraction of 1. [...]
It's been mentioned before, but what do you mean by "the bias?"
If you mean the offset added to the exponent's numerical value to
produce the encoded value, that's wrong. If you mean something
else, it would be as well to explain what you mean.
You are right again. Actually, the bias is 1023, and the value is
971.
#include <stdio.h>
#include <float.h>
int main(void)
{
double d = DBL_EPSILON;
int *p = (int *)&d;
printf("%a\n",DBL_EPSILON);
printf("0x%x 0x%x\n",p[0],p[1]);
}
0x1.000000p-52
0x0 0x3cb00000
3cb == 971
971-1023 --> -52
2 ^-52 --> 2.2204460492503130808472633361816e-16 -->DBL_EPSILON.
Similar calculations can be done for the other types. I will correct
this.
.
- References:
- Machine epsilon: conclusion
- From: jacob navia
- Re: Machine epsilon: conclusion
- From: Eric Sosman
- Machine epsilon: conclusion
- Prev by Date: Re: segmentation fault
- Next by Date: Re: Struct assignment
- Previous by thread: Re: Machine epsilon: conclusion
- Next by thread: Re: Machine epsilon: conclusion
- Index(es):
Relevant Pages
|
|