Undefined behaviors & Clang 3.3
Simen Kjaeraas
simen.kjaras at gmail.com
Sat Jun 22 00:59:02 PDT 2013
On Sat, 22 Jun 2013 02:14:18 +0200, eles <eles at eles.com> wrote:
> BTW, floats do not wrap, why integers should behave otherwise?
Because that's how the hardware works. IEEE-754 floats have special values
that do not behave like other numbers: infinity and nan. The ints the
hardware supports have no such thing.
Of course, one could write a complex wrapper around the int to get infinity
in there, and even nan if one really wanted, but that'd be a lot less
efficient, and contrary to how people expect things to work.
--
Simen
More information about the Digitalmars-d
mailing list