#1249 Fix time scaling in PLI TF routines for MinGW


When built with MinGW, pow() may not always generate an exact integer result when supplied with integer operands. Converting the result to an integer before we use it seems to be enough to work round this issue.

This patch is for both devel and v0.9. The bug is caught by the existing VPI regression tests.

For reference, the description of the issue in the MinGW math.h header file is:

/* Excess precision when using a 64-bit mantissa for FPU math ops can
cause unexpected results with some of the MSVCRT math functions. For
example, unless the function return value is stored (truncating to
53-bit mantissa), calls to pow with both x and y as integral values
sometimes produce a non-integral result.
One workaround is to reset the FPU env to 53-bit mantissa
by a call to fesetenv (FE_PC53_ENV). Amother is to force storage
of the return value of individual math functions using wrappers.
NB, using these wrappers will disable builtin math functions and
hence disable the folding of function results at compile time when
arguments are constant. */


  • Cary R.

    Cary R. - 2012-08-06

    Applied and pushed to both V0.9 and development.

  • Cary R.

    Cary R. - 2012-08-06
    • milestone: 530241 --> v0.9-branch
    • status: open --> closed-accepted

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks