Mail Archives: djgpp/1995/01/02/04:20:45
(Please check your mail software -- it inserts all kinds of
funny codes, that makes your text hard to read.)
I have a paradox I cannot understand. I have compiled a program under
GCC and under Borland TC (v. 2.0) and TC++ (v. 3.1) for Windows,
and both versions give results quite different, being the GCC version
the correct one. I include a simple code that represent the simplifie=
d
core of the problem: a double obtained from a product and stored subt=
racted
=66rom the same product does not give 0 as result. It seems an error =
of
Borland compilers but I feel it to serious to be true; I'd like to kn=
ow
if it is a real bug or if it has some justification (although the res=
ult
is erroneus) and if there is some way to skip the error without affec=
ting
the code performace.
This is a feature, not a bug :-)
Seriously, compilers are allowed to work with higher precision
for temporary results than for values stored in `double'
variables. The compiler just differ in their oppinion of
`temporary'.
Morten
--
-------------------------------------------------------------------------
For information on the free Republic of Macedonia connect to the WWW link
http://ASUdesign.eas.asu.edu/places/Macedonia/republic/
-------------------------------------------Morten Welinder, terra AT diku DOT dk
- Raw text -