From: David Abrahams (abrahams_at_[hidden])
Date: 2000-10-19 12:24:23
----- Original Message -----
From: "Swatosh, Joe R NWP" <joe.r.swatosh_at_[hidden]>
Sent: Thursday, October 19, 2000 12:47 PM
Subject: [boost] Bug in numeric_cast<> ??
> Well, I've been lurking a while, and we've been using the bits of boost we
> find useful (thanks!) and we've finally run into a place where we got
> surprised. Specifically, we've been using numeric_cast<> for a while and
> it's been working slick. Yesterday we ran into a little problem so today
> added the following lines to cast_test.cpp, either one causes it to fail:
> assert( 0.0f == numeric_cast<float>( 0.0 ) );
> assert( 0.0 == numeric_cast<double>( 0.0 ) );
> Which looks to me like a bug, or am I abusing the notion of
> BTW we're using MSVC6.0sp4 with Dinkum's STL.
Your test looks right to me, though the notion of floating-point equality is
I guess the question is, is this a compiler bug or a bug in the library?
Ah. We're being bitten by the asymmetry of numeric_limits<>::min() for
non-integer (floating) types. I'll check in and post a fix shortly. Thanks
for the bug report.
P.S. Beman, could you add this test to the regression suite?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk