Re: Trouble with integer floating point conversion



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



Relevant Pages

  • Re: What is the exact value of a mole?
    ... cannot cite the weight with the balance's stated precision of +/- 0.01 mg? ... make a second set of measurements with the same precision, ... Good luck in your chemistry, and I feel sorry for your clients. ... If you would (to quote a phrase) get off your lazy ass, ...
    (sci.chem)
  • Re: 2008 World Temperatures
    ... On Wed, 17 Dec 2008 at 12:08:18, Graham Easterling wrote in uk.sci.weather: ... I had 1,000 barometers calibrated to the same standard, and managed to ... I was always told that you mustn't quote an average to a greater precision than the accuracy of the instrument. ...
    (uk.sci.weather)
  • Re: Any German speakers here?
    ... What precision do you need? ... >The difference between RG214 and RG58 is the voltage ... [begin quote] ... and are specified as 50.0 ohms impedance. ...
    (sci.electronics.design)
  • Re: Cantor Confusion
    ... Read the quote below. ... contradiction. ... You simply fail to distinguish sharply enough between y and y'. ... precision by rational numbers. ...
    (sci.math)
  • Re: Fadal 104/D(eceased)
    ... >> CNC controls. ... >> runtime program toggle from single precision to double precision ... >> My question is that we have standard NEMA motors, ... Why not standard controllers and g/n ...
    (alt.machines.cnc)