Double-precision trig functions in C seem to be 1.5x slower when compiling for 64-bit environment than with 32-bit, dunno why

· · Web · 2 · 0 · 1

Ah, 64-bit instruction set doesn't even have a FSIN/FCOS command - it uses a C library on top of SSE2, whereas perhaps 32-bit mode uses the old x87 hardware command

@sjb I’m a bit of an expert with these things, probably a stack overflow in the iteration due to the complexity of all the extra bit overheads.

@BobJohn It's surprising because in my tests of other floating-point-heavy programs, 64-bit was up to 2x faster than 32-bit. I'm guessing because SSE2 was enabled in 64-bit mode.

However, I'm now confused exactly where trig functions are calculated. I thought the CPU had hardware for it but maybe not?

@sjb It all depends on the orientation of the flops and if they are in-silica optimised, otherwise your going to need a bigger bus.

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!