Bug#572746: libm: sinf/cosf performance is awful on amd64
Hi,
I do not complain about the sin/cos performance but only on the float variants.
Using -ffast-math gives a nice performance boost but leads to bad results (in our
cases which may be different from the simple given example) so it's not really a
workaround.
In fact, I don't really care about super-accuracy and the glibc standard
implementations gives us good results.
Maybe sinf/cosf in 32 bits is a bit broken but that worked for us in terms of
precision and performance. On 64 bits, I can only rely on precision, as
performance is gone :(
Jerome
On Wednesday 17 March 2010, Vincent Lefevre wrote:
> On 2010-03-06 11:42:51 +0100, Jerome Vizcaino wrote:
> > After many tests and research I've come to the conclusion that the
> > float variants of
> > sin/cos (and maybe others) are anormaly slow Debian amd64.
>
> Note that on amd64, sin and cos may be slow, but at least they are
> mostly correct (in rounding to nearest only). In 32-bit mode (-m32),
> the hardware fsin/fcos instructions (and implementation) are used,
> but they are buggy on large arguments, just like sincos in 64-bit
> mode (which uses the hardware instruction fsincos), and not as
> accurate as the MathLib version on small arguments (even though
> MathLib has a bug in its error analysis for sin).
>
> If you don't mind about correctness, you can still use the -ffast-math
> GCC option (you don't use it in your Makefile). Depending on the
> application, this can be OK, but don't complain if you get incorrect,
> inaccurate or unexpected results in some cases.
>
> This was for sin/cos. I don't know how sinf/cosf are implemented
> in 32-bit and 64-bit modes, but make sure they don't have the same
> problem. If they do, this bug is invalid.
>
> Regards,
>
Reply to: