|
Boost : |
From: Ruben Perez (rubenperez038_at_[hidden])
Date: 2025-01-19 13:04:36
Hi,
Some problems I've found:
The decimal32 doc page states that the minimum normalized value is
1e-95. The std::numeric_limits<>::min() function agrees with that.
However, fpclassify and similar functions don't seem to agree:
// Both of the above print "1"
std::cout << issubnormal(std::numeric_limits<boost::decimal::decimal32>::min())
<< std::endl;
std::cout << issubnormal(1.0e-95_df) << std::endl;
Printing very small values seem to do nothing:
// This prints an empty line
auto v = 1.0e-94_df;
std::cout << v << std::endl;
Calling to_chars with subnormal values fails with
std::errc::not_supported, regardless of the chars_format used:
// This prints: Error: generic:95
void f(decimal32 v)
{
char buff[64]{};
auto r = boost::decimal::to_chars(buff, buff + sizeof(buff), v);
std::cout << "Error: " << std::make_error_code(r.ec) << std::endl;
}
int main()
{
auto v = 1e-95_df;
f(v);
}
Am I doing something stupid?
Regards,
Ruben.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk