Microsoft KB Archive/120959

= DOC: Documentation on fmod Is Incorrect =

Article ID: 120959

Article Last Modified on 10/2/2003

-

APPLIES TO


 * The C Run-Time (CRT)

-



This article was previously published under Q120959



SUMMARY
The fmod(x,y) function returns the floating point remainder of x/y, where x and y are floating point numbers. If y is 0.0, fmod should return a NAN(not a number) which it does, but the documentation on fmode says incorrectly that it should return 0.

The document has been corrected in Visual C++ 2.0.



Sample Code

 * 1) include 
 * 2) include 

void main(void) { double x=10.0, y=0.0, z;

z=fmod(x,y); printf("The remainder of %.2f/%.2f is %f\n", x, y, z); }

Output
The remainder of 10.00/0.00 is -1.#IND00 // Correct output

Additional query words: 1.00 2.00 double remainder

Keywords: kbcrt kbdocfix KB120959

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.