
2009/1/26 Hermann Rodrigues
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)
Sorry, I may confuse with something else. At least, if you try 2.6, it will print as 2.5999...
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.
No, I don't think so, and I don't think it should raise an exception either. Matthieu -- Information System Engineer, Ph.D. Website: http://matthieu-brucher.developpez.com/ Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn: http://www.linkedin.com/in/matthieubrucher