|
|
Message-ID: <7582613-e06a-eeed-a6be-c6dd6159e5d@esi.com.au> Date: Sun, 1 Feb 2026 10:55:08 +1100 (AEDT) From: Damian McGuckin <damianm@....com.au> To: MUSL <musl@...ts.openwall.com> Subject: Slightly faster 'scalbn(x,i) = x*2**i' In the course of helping a colleage debug a problem with ldexp/scalbn in Apple's LIBM for ARM, I ported a custom version of scalbn() written in Chapel to C. The resulting C code was pretty much like MUSL for 2**i being a normal number (or a number greater than the largest floating point number). But, for 2**i being subnormal (or effectively even smaller) and |x| being normal, it avoids the multiplications seen in MUSL. The X86-64 assembler code size from both GCC11 and CLANG19 is much the same. Just for fun, I timed it against MUSL's routine and it is about 30% faster over a broad range of input. As MUSL's scalbn() is not a performance hog and it easy to read, I see no reason to suggest changing it. Let me know if anybody thinks otherwise. Thanks - Damian
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.