Re: how long is double

From: Martijn Lievaart (m_at_remove.this.part.rtij.nl)
Date: 01/07/04


Date: 7 Jan 2004 03:50:05 -0500

On Tue, 06 Jan 2004 06:35:26 -0500, kanze wrote:

> I think that this was Francis' point. According to the standard, a+b+c
> is (a+b)+c. The compiler is free to rearrange this any way it pleases,
> as long as the results are the same as if it had done (a+b)+c. On most
> machines, with integer arithmetic, there is no problem. On no machine
> that I know of, however, can the compiler legally rearrange floating
> point, unless it absolutely knows the values involved.
>
> There was quite a lot of discussion about this when the C standard was
> first being written. K&R explicitly allowed rearrangement, even when it
> would result in different results. In the end, the C standard decided
> not to allow this.

Then this seems a place where C and C++ differ, see the answer and quote
from the C++ standard from Ron Natalie.

Anyone who can confirm this?

M4

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated. First time posters: Do this! ]



Relevant Pages

  • Re: how long is double
    ... Martijn Lievaart writes ... >> machines, with integer arithmetic, there is no problem. ... >> that I know of, however, can the compiler legally rearrange floating ... In the end, the C standard decided ...
    (comp.lang.cpp)
  • Re: DAT playback issue- refresher course needed
    ... and the interfaces are nonstandard and do not actually ... They will usually work with most AES/EBU devices ... off of hours and hours of tapes (recorded on many different machines), ... standard digital I/O and a reliable transport. ...
    (rec.audio.pro)
  • Re: Accessing Apps through RWW
    ... It is Standard with 2 nics. ... When I setup the machines using the connect ... computer wizard I got a message stating that I am not authorized to view this ...
    (microsoft.public.windows.server.sbs)
  • Re: LSE64 in standard Forth
    ... complement machines for ages, so it's simply the same thing as with C: ... two's complement unless you are on a really exotic piece of hardware. ... But in Standard Forth it's not well defined, not because of the two's complement issue, but because of the size. ... Three of the four C implementations listed in K&R edition 1 are 8/16/32 bit machines. ...
    (comp.lang.forth)
  • Re: #define BITS_PER(x) (8 * sizeof(x))
    ... People are allowed to present hypothetical machines to make a point. ... (Committee oversight is not an adequate answer; ... needs to evolve, let it evolve.) ... Put in a request for it to be added to the standard. ...
    (comp.lang.c)