On Sep 27, 7:06 am, Aman JIANG <AmanJI...@gmail.com> wrote:
> On Sep 27, 2:45 am, Kai-Uwe Bux <jkherci...@gmx.net> wrote:
[...]
> I have no idea ... that you said you donnot have a XP system,
> but this problem is just depend on OS and compiler.
The problem depends on the implementation of the library, and
perhaps on the compiler (or the compiler flags) with which it
was compiled.
In many cases, different parts of the library have difference
sources. On most Unix systems, for example, g++ will use
libstdc++ (it's own implementation) for the iostream's, but will
use the implementation in libc (bundled with the system) for the
printf family---given the irrelevance of the digits you're
asking for, and the anomalies which may be associated with
floating point rounding, it's not too surprising that the
results aren't exactly the same. Rounded to 17 significant
digits, they should be the same, but beyond that, it's really
just noise. (I'm not sure what the situation is with VC++. I
know that Dinkumware provides the C++ library, but I wouldn't be
surprised if the printf stuff were some legacy Microsoft code.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34