FIX: Library Version of atan2(0,0) Does Not Return 0Last reviewed: September 18, 1997Article ID: Q122276 |
1.00 2.00 2.10 4.00
WINDOWS NT
kbprg kbbuglist kbfixlist
The information in this article applies to:
SYMPTOMSThe on-line help and documentation for Visual C++ specify that calling the atan2 function should return 0.0 if both parameters are 0. The documentation is correct, but the library version of atan2() does not return 0.0, rather, it returns a "not a number" value.
RESOLUTIONThe true intrinsic version of atan2() works as documented. There are two ways to instruct the compiler to use the true intrinsic version of the atan2() function:
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Microsoft Visual C++ 32-bit Edition, version 4.1.
MORE INFORMATIONA true intrinsic function is a function that gets expanded inline without the overhead of a function call. These can be faster than full function calls. In the case of atan2(), both arguments are pushed onto the floating point stack, and the arctangent of y/x is calculated via the fpatan instruction. The "not a number" value is -1.#IND00.
Sample Code
/* Compile options needed to show the problem: none Compile options for workaround /Oi /Og */ #include <stdio.h> #include <math.h> void main(void) { double testreturn; testreturn = atan2(0.0,0.0); printf("testreturn = %lf",testreturn);}
|
Additional reference words: 1.00 1.10 2.00 4.00 partial arctangent
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |