Re: C2124 is most disrespectful of IEEE floating point arithmetic
- From: "Alexander Grigoriev" <alegr@xxxxxxxxxxxxx>
- Date: Sun, 27 Aug 2006 21:47:09 -0700
This is a compile-time constant expression, and is evaluated on compilation
time.
"Dr Pizza" <DrPizza@xxxxxxxxxxxxxxxxx> wrote in message
news:xn0eqhw1a4lwx05000@xxxxxxxxxxxxxxxxxxxxxxx
Since VC++ purports to follow IEC 559, and IEC 559 defines the division
of a non-zero by a zero to be a signed infinity, isn't it rather silly
that:
float inf(1.0f / 0.0f);
should result in a compile-time error, C2124? An error may be
appropriate for integer arithmetic (as it'll generate a runtime SEH
exception), but for floating point arithmetic it's surely incorrect
behaviour?
What gives? Am I being unreasonable in my expectations? It's
certainly rather nicer to type the above than have to spew:
float inf(std::numeric_limits<float>::infinity());
--
.
- Follow-Ups:
- References:
- Prev by Date: Re: C2124 is most disrespectful of IEEE floating point arithmetic
- Next by Date: VC8 build much slower than VC7
- Previous by thread: Re: C2124 is most disrespectful of IEEE floating point arithmetic
- Next by thread: Re: C2124 is most disrespectful of IEEE floating point arithmetic
- Index(es):
Relevant Pages
|
Loading