Boost logo

Boost Users :

Subject: Re: [Boost-users] Numeric_cast from int to float
From: Hermann Rodrigues (hermann.rodrigues_at_[hidden])
Date: 2009-01-26 13:44:13


>> I always thought that the conversion from int to float could raise an
>> exception when the int can not be properly represented as a float.
>
> Well, in this case, even casting 2 should raise an exception :|

But the IEEE spec says that every integer less than 2^24 can be
exactly represented as a single precision floating point number...
(http://en.wikipedia.org/wiki/Floating_point)

So, I am still confident that converting integers greater that 2^24 to
float using boost::numeric_cast must raise an exception. Has this
behavior changed in the newer versions of Boost?

Best.

--
Hermann Rodrigues
hermann_at_[hidden]
Centro de Sensoriamento Remoto / UFMG
http://www.csr.ufmg.br/dinamica

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net