On Fri, Sep 28, 2012 at 1:01 AM, Mateusz Loskot <[email protected]> wrote:
> On 27 September 2012 17:19, Vadim Zeitlin <[email protected]> wrote:
> > On Thu, 27 Sep 2012 19:50:08 +0400 Sergei Nikulov <
> [email protected]> wrote:
> >
> > SN> So it can be MSVS2010 issue.
> >
> > Microsoft CRT has known issues with converting NaNs and infinities
> to/from
> > strings and behaves differently from most (all?) Unix libc
> implementations,
> > so I'm almost sure it is indeed MSVS-specific. However you can't change
> its
> > CRT behaviour so this still needs to be worked around somehow.
>
> Textual representation of NaN value and features like strtod("NAN")
> are specified by C99 standard. Visual C++ does not implement C99.
>
But that's not what we're talking about here. What Sergei reported is that
MSVC sees a very long number (longer than a double can store) in
std::istringstream's underlying buffer, tries to read a double from this
stream, and instead of putting the stream in failed state puts inf in the
double. I.e., something like
double x;
std::istringstream
iss("99999999999999999999999912222222222222222222222222223"
"9999999999999999999999991222222222222222222222222222333333333333"
"9999999999999999999999991222222222222222222222222222333333333333"
"9999999999999999999999991222222222222222222222222222333333333333"
"9999999999999999999999991222222222222222222222222222333333333333"
"9999999999999999999999991222222222222222222222222222333333333333"
"9999999999999999999999991222222222222222222222222222333333333333"
"9999999999999999999999991222222222222222222222222222333333333333"
"9999999999999999999999991222222222222222222222222222333333333333"
"9999999999999999999999991222222222222222222222222222333333333333"
"9999999999999999999999991222222222222222222222222222333333333333"
"9999999999999999999999991222222222222222222222222222333333333333"
"9999999999999999999999991222222222222222222222222222333333333333"
"9999999999999999999999991222222222222222222222222222333333333333"
"9999999999999999999999991222222222222222222222222222333333333333");
iss >> x;
With gcc iss.fail() is true after this operation, with MSVC apparently it
contains infinity.
Thanks,
Aleksander
> > SN> Can anybody confirm?
>
> I don't have MySQL installed, so I can't test it.
> But PostgreSQL and SQLite3 tests work for me.
>
> Best regards,
> --
> Mateusz Loskot, http://mateusz.loskot.net
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://ad.doubleclick.net/clk;258768047;13503038;j?
> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
> _______________________________________________
> Soci-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/soci-users
>
------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users