On Fri, Sep 28, 2012 at 9:26 PM, Roger Orr <[email protected]>wrote:

> > -----Original Message-----
> > From: Mateusz Loskot [mailto:[email protected]]
> > Sent: 28 September 2012 11:07
> > To: General-purpose list for SOCI users.
> > Subject: Re: [SOCI-users] SOCI // MySQL // failed test case 4
> >
> > > 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.
> >
> > Aleksander,
> >
> > I missed the point, indeed.
> >
> > That is interesting issue, and I also recall it's MSVC-specific.
> > I always assumed it is related to C99 behaviour of  strtod-like parsing.
> >
> > Curiosity. I may try to ask MS folks about that.
>
> This is an unresolved issue in the C++ standard!
> See http://cplusplus.github.com/LWG/lwg-unresolved.html#1169


Thank you Roger.

I'll admit I am not very well versed in the C++ standard lingo, but, does
the link imply that the gcc behavior is incorrect?  It says: "On the other
hand, the result of num_get conversion of such out-of-range floating-point
values results in the most positive/negative representable value." ...
"highest representable (which is, usually, the infinity)".  So does this
imply that MSVC is standard-conforming and gcc is wrong?  This is hard to
believe.

Thanks,

Aleksander


>
> 1169. num_get not fully compatible with strto*
>
> Regards,
> Roger.
>
>
>
> ------------------------------------------------------------------------------
> 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
>
------------------------------------------------------------------------------
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

Reply via email to