[Cfp-interest] functions - math function special cases

Jim Thomas jwthomas at cup.hp.com
Wed Aug 4 15:22:18 PDT 2010


In a quick check of math function special cases in 754-2008 (9.2) vs C99 
Annex F, the only discrepancies I saw were in pow.

C99 has

  pow(+-0, y) returns +Inf and raises the "divide-by-zero" 
floating-point exception for y < 0 and not an odd integer.

This isn't quite right because pow(+-0, -Inf) should not raise/signal 
divide-by-zero. 754-2008 separates out this case and says

  pow(+-0, -Inf) is +inf with no exception.

The C committee might accept this change for C1x.

Another difference (in pow) is that C99 calls out ten more special cases 
for infinite arguments, e.g., pow(x, -Inf) returns +Inf for |x| < 1. 
Whereas 754-2008 doesn't mention these cases. Does something else in 
754-2008 imply them?

-Jim


More information about the Cfp-interest mailing list