|
Boost Users : |
Subject: [Boost-users] Numeric_cast from int to float
From: Hermann Rodrigues (hermann.rodrigues_at_[hidden])
Date: 2009-01-26 12:03:07
Hi,
I am using boost::numerical_cast to cast different numerical types in
my code. Everything always seems to work as I expected except for a
small thing:
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.
However, this is not what I am gettingn in version 1.33.1. For
example, in my opinion, casting -2147483647 to a float should be
raising an exception but boost::numerical_cast always says that the
conversion is valid and well-formed.
Obviously, my boost version is a little outdated, but I can not
upgrade at this time due to several constraints.
My question is: is this behavior either a bug (even in newer versions
of boost) or a feature?
Thank you in advance.
-- 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