[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unexpected frexpf implementation used by MSVC9 in C++ mode
From: |
Michael Goffioul |
Subject: |
Re: Unexpected frexpf implementation used by MSVC9 in C++ mode |
Date: |
Sun, 11 Mar 2012 21:24:16 +0000 |
On Sun, Mar 11, 2012 at 6:58 PM, Michael Goffioul
<address@hidden> wrote:
> To confirm my suspicion, I tested the following sample:
>
> #include "config.h"
> #include <math.h>
> #include <stdio.h>
>
> int main (int argc, char** argv)
> {
> volatile float x;
> float zero = 0.0f;
>
> x = 1.0f / zero;
> {
> int exp;
> #ifdef __cplusplus
> float y = gnulib::frexpf (x, &exp);
> #else
> float y = frexpf (x, &exp);
> #endif
> if (y != x)
> printf ("failed\n");
> }
>
> return 0;
> }
>
> This code will print "failed" when the MSVC implementation is used
> instead of the gnulib replacement. The files config.h and math.h are
> taken from the compiled octave sources. When compiling in C mode, it
> works fine, nothing is printed. When compiled in C++ mode, it fails.
> In C++ mode, I can even compile and link it without including gnulib
> sources like frexp.c, which indicates gnulib replacement is not used.
>
> Michael.
Additional information: frexpf is actually defined as a macro in C,
and as an inline function in C++.
Michael.