Re: Trouble with integer floating point conversion
- From: James Kuyper <jameskuyper@xxxxxxxxxxx>
- Date: Thu, 13 Dec 2007 12:50:58 GMT
jacob navia wrote:
James Kuyper wrote:jacob navia wrote:To the subject of precision, the standard says:
<quote>
The accuracy of the floating-point operations (+, -, *, /) and of the
library functions in <math.h> and <complex.h> that return floating-point
results is implementation defined.
The implementation may state that the accuracy is unknown
<end quote>
i.e. IT CONFIRMS what I am saying. There aren't any guarantees at all.
There are no guarantees about the accuracy for implementations that don't pre-define __STDC_IEC_559__. The Numerical Limits section he cited does, however, contain a great many guarantees about things other than the accuracy.
That is fine but we are speaking about the accuracy here
While the original poster's problem was with the accuracy of the calculations, your very first response was about the precision, not the accuracy. An 80-bit number can hold an inaccurate number with much greater precision than an 64-bit number; in itself that doesn't make the number any more accurate.
The standard does say things about the precision. The values for LDBL_EPSILON, DBL_EPSILON, and FLT_EPSILON depend very directly on the precision of floating point operations, and the standard sets a maximum value for the magnitude of that constant, which implies a minimum number of bits of precision.
The standard also says things about when it's permissible to use a higher precision type for intermediate steps in calculations, and it seems to be precisely that issue which is the actual reason for the discrepancies that the original poster reported. See 5.2.4.2.2p8. If FLT_EVAL_METHOD were 0, then he shouldn't have seen those discrepancies. For any other value of FLT_EVAL_METHOD, such discrepancies are always a possibility.
.
- References:
- Trouble with integer floating point conversion
- From: rembremading
- Re: Trouble with integer floating point conversion
- From: rembremading
- Re: Trouble with integer floating point conversion
- From: jacob navia
- Re: Trouble with integer floating point conversion
- From: Francine . Neary
- Re: Trouble with integer floating point conversion
- From: jacob navia
- Re: Trouble with integer floating point conversion
- From: Flash Gordon
- Re: Trouble with integer floating point conversion
- From: jacob navia
- Re: Trouble with integer floating point conversion
- From: James Kuyper
- Re: Trouble with integer floating point conversion
- From: jacob navia
- Trouble with integer floating point conversion
- Prev by Date: this is a test
- Next by Date: Re: What is considered macro abuse?
- Previous by thread: Re: Trouble with integer floating point conversion
- Next by thread: Re: Trouble with integer floating point conversion
- Index(es):
Relevant Pages
|