PRB: pow() Returns Incorrect Value

ID Number: Q32746

5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a

MS-DOS | OS/2

docerr

Summary:

Calling the run-time function pow(0.0,-1.0) should return HUGE_VAL,

according to the documentation of the function on page 455 of the

"Microsoft C Run-Time Library Reference" for version 5.1. However, the

function returns 0.0 and prints a DOMAIN error message.

The ANSI specification or the C Programming Language (ANSI X3.159-

1989), Section 4.5.5.1, states:

A domain error occurs if the result can not be represented when

x is zero and y is less than or equal to zero.

Therefore, a DOMAIN error is expected behavior in this specific

instance.

More Information:

Sample Code

-----------

/* Compile options needed: none

*/

#include <stdio.h>

#include <math.h>

void main(void)

{

double x;

x = pow(0.0, -1.0);

printf("x = %le, HUGE_VAL = %le\n", x, HUGE_VAL);

}

Additional reference words: 6.0 6.00 6.0a 6.00a 6.0ax 6.00ax 7.00