Re: how long is double
From: Balog Pal (pasa_at_lib.hu)
Date: 01/06/04
- Next message: Chris \( Val \): "Re: Help with template find_if predicate"
- Previous message: Bhu*** Joshipura: "Re: Order of evaluation and better declaration of functions"
- In reply to: Francis Glassborow: "Re: how long is double"
- Next in thread: Ron Natalie: "Re: how long is double"
- Reply: Ron Natalie: "Re: how long is double"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 5 Jan 2004 19:37:49 -0500
"Francis Glassborow" <francis@robinton.demon.co.uk> wrote in message
news:qPVLV3BKvT+$Ewh7@robinton.demon.co.uk...
> >IMHO a more likely explanation can be that the 3 numbers in a + b + c are
> >added in a different order. And that is a possible source of difference
at
> >the last bit of the precision.
>
> I am not sure that the compiler has that much freedom when the order
> produces different results. This is not the same as the requirements re
> order of evaluation of sub-expressions (i.e. that there is no
> requirement)
Suppose I have expression, like
double d = 1.1 + x + 2.2 + 3.3; // we have double x in scope
here the compiler must generate code that will do 3 separate additions an
that order? And emitting code equivalent to expression
double d = x + 6.6;
is not really allowed, just in practice we allow the compiler doing it
anyway with some switch?
IIRC the question for this thread used MSVC which has the /Op [Improve Float
Consistency] option. Which the original poster likely dind't use
consistently.
Paul
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
- Next message: Chris \( Val \): "Re: Help with template find_if predicate"
- Previous message: Bhu*** Joshipura: "Re: Order of evaluation and better declaration of functions"
- In reply to: Francis Glassborow: "Re: how long is double"
- Next in thread: Ron Natalie: "Re: how long is double"
- Reply: Ron Natalie: "Re: how long is double"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]