Prev: Static variable in template function
Next: How to reuse an existing stream with a different streambuf ?
From: George Neuner on 10 Jun 2010 10:10 On Wed, 9 Jun 2010 07:27:19 CST, AlMel <alexander.melkozerov(a)gmail.com> wrote: >The problem here is not the floating-point '=' operator >but rather Visual C++ standard library (in particular, the >stringstream implimentation) which does not interpret "0.0003" and >"3.e-4" as a same floating-point number. The resulting binary floating- >point representations differ by a small quantity (epsilon). In GCC, >the standard library correctly reads both notations and produces the >same binary representation. Identical parsing of different FP formats by the stream library has been broken for a long while - at least since VS2002 and maybe earlier. However, if you write out and read back using the same format, the results are consistent ... could be that's all the professional developers care about. Without meaning to start a holy war, sscanf() will give you consistent results parsing the various FP formats on both VS and GCC. George -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
First
|
Prev
|
Pages: 1 2 Prev: Static variable in template function Next: How to reuse an existing stream with a different streambuf ? |