Some math functions return results that are not correct when you compile them by using the gcc compiler tool in Windows Services for UNIX 3.5 (891755)
The information in this article applies to:
- Microsoft Windows Services for UNIX 3.5
SYMPTOMSWhen you compile a program by using the gcc C language
compiler tool that is included in the Microsoft Interix software development kit (SDK) on
Microsoft Windows Services for UNIX 3.5, some math functions, such as the hypot
function, may return results that are not correct.CAUSEThis problem occurs because the math function that is used is
not declared in the source code. By default, the function will
return an integer (int) value when this problem occurs, instead of the correct data type value.
Note This problem occurs even when you include the math.h header file in
the source code. Because Windows Services for UNIX 3.5 follows the POSIX standard,
function declarations that do not comply with the POSIX standard are
ignored.RESOLUTIONTo resolve this problem, follow these steps:
- Define the _ALL_SOURCE macro in your source code, and then
include the math.h header file in your source code. For example, you can add an
_ALL_SOURCE macro value of 1 before the math.h header file in your source code:
#define _ALL_SOURCE 1
#include <math.h> - Compile the source code by using the gcc
compiler tool.
Modification Type: | Major | Last Reviewed: | 1/20/2005 |
---|
Keywords: | kbtshoot kbprb KB891755 kbAudDeveloper |
---|
|