PRB: Incorrect Results Returned, C Float Functions (79381)
The information in this article applies to:
- Microsoft FORTRAN Compiler for MS-DOS 4.1
- Microsoft FORTRAN Compiler for MS-DOS 5.0
- Microsoft FORTRAN Compiler for MS-DOS 5.1
- Microsoft FORTRAN compiler for OS/2 4.1
- Microsoft FORTRAN compiler for OS/2 5.0
- Microsoft FORTRAN compiler for OS/2 5.1
This article was previously published under Q79381 SYMPTOMS
When using the Microsoft FORTRAN Compiler version 4.1, 5.0, or 5.1, if
FORTRAN code attempts to access a C float function, incorrect results may
be returned from the C function.
CAUSE
FORTRAN expects a DOUBLE PRECISION number to be returned from both REAL and
DOUBLE PRECISION functions. C functions of type float return only 4 bytes,
and the FORTRAN run-time incorrectly interprets the value stored in the
floating accumulator (__fac) as an 8-byte number.
RESOLUTION
This problem can be avoided by declaring the C function as type double, or
by declaring the C function with the _fortran attribute.
Modification Type: | Major | Last Reviewed: | 12/1/2003 |
---|
Keywords: | KB79381 |
---|
|