Re: float to int conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2013-04-22 11:58:48 +0100, David Paterson wrote:
> It depends what you mean by "catching errors".  As far as rounding is
> concerned you won't get an exception, or a detectable error such as a
> NaN.

There's the "inexact" exception. But contrary to invalid operations
(and overflows, at least in rounding to nearest), the only way to
detect it is to test the exception status flags; the numerical
value won't say anything about the exception (unless you have some
knowledge about it, such as you know that the value is an integer
but you don't get an integer... But not all inexact exceptions can
be detected in such a way).

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux