On Wed, 7 Sep 2016, Martin Storsjö wrote:

Hi,

In my testing with mingw-w64 on ARM, I've run into a number of issues with
the implementation of the math routines. Some of these issues are:

The whole family of log functions is problematic (even after my fix for
the number of iterations in 41de4baaccba), e.g. log2() only returns values
in the range -17.6 - 7.73, for values outside.

For some values, it even crashes. IIRC, the issue iss an infinite
recursion; bsd__ieee754_powf calls scalbnf, which calls bsd__ieee754_powf.
E.g. log2f(strtod("1.225000", NULL)) will show this behaviour (using
strtod to avoid any risk of the compiler evaluating it at compile time).

Likewise sin/cos and pow also have implementation accuracy issues - I
haven't dug quite as deep into these, but just removing them (and linking
to the msvcrt.dll versions instead) make the remaining libav testsuite
failures go away. (Tested on wine though, whose msvcrt implementation
might be better in some aspects than the real msvcrt.dll.)

Functions like floor and ceil are implemented using vcvtr.s32.f64, which
effectively limits the range of these functions to what is expressible
with signed 32 bits. This isn't that I've run into in actual real world
code though, but it was noted at some point that it could be an issue.


I understand that mingw-w64 wants to reimplement math functions instead of
linking to msvcrt in order to get proper C99 compliance. For the mentioned
families of functions (log, pow, sin, cos), what C99 compliance issues are
there with the msvcrt.dll implementations?

With no response to this (André?), I'll post my patch for removing the softfloat math functions and just delegating to msvcrt.dll. If someone actually runs into issues with C99 compliance after that, we can look into fixing that in one way or another (see the previous mail for some suggestions), but the current softfloat functions don't work reliably enough for real applications.

// Martin
------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to