Curious. The number is between min() and denorm_min() for doubles:
std::cout << "1.78358e-321=" << 1.78358e-321 << std::endl;
std::cout << "min=" << std::numeric_limits<double>::min() << std::endl;
std::cout << "denorm min=" << std::numeric_limits<double>::denorm_min() << std::endl;
prints:
1.78358e-321=1.78358e-321
min=2.22507e-308
denorm min=4.94066e-324
My go-to reference
http://www.cplusplus.com/reference/limits/numeric_limits/
says min() is:
Minimum finite value.
For floating types with denormalization (variable number of exponent bits):
minimum positive normalized value.
Equivalent to CHAR_MIN, SCHAR_MIN, SHRT_MIN, INT_MIN, LONG_MIN, LLONG_MIN, FLT_MIN,
DBL_MIN, LDBL_MIN or 0, depending on type.
and for denorm_min(), it says:
Minimum positive denormalized value.
For types not allowing denormalized values: same as min().
I have no idea what denormalization is, but it looks relevant here.
- Bob
On 6/7/13 12:14 PM, Michael Betancourt wrote:
> I don't have a strong opinion either way, but using another parser would complicate the code nontrivially and remove
> much of the motivation for using a stringstream.
>
>
> On Fri, Jun 7, 2013 at 3:58 PM, Marcus Brubaker <
marcus.a...@gmail.com <mailto:
marcus.a...@gmail.com>> wrote:
>
> Hmmm, that seems like fixing the wrong problem.
>
> If this is a bug in stringstream parsing, what happens when you use something like strtod() or atof()? Not "pure
> C++" style, but at least it's working around the bug itself.
>
> Cheers,
> Marcus
>
>
> On Fri, Jun 7, 2013 at 7:01 AM, Michael Betancourt <
betan...@gmail.com <mailto:
betan...@gmail.com>> wrote:
>
> I tracked down the bug in bin/print, and it occurs when string stream tries to parse a number in scientific
> notation with three digits in the exponent, for example "ss >> 1.78358e-321". The stream fails, and then
> further uses of operator>> read from random memory, hence the incorrect results.
>
> This looks like a bug in stringstream (two digits in the exponent parses just fine) -- does anyone have any
> problem with my thresholding values in mcmc_writer? Basically anything below 1e-50 would be set to zero.
>
> --
> You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
>
stan-dev+u...@googlegroups.com <mailto:
stan-dev%2Bunsu...@googlegroups.com>.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
>
stan-dev+u...@googlegroups.com <mailto:
stan-dev%2Bunsu...@googlegroups.com>.