|
|
Message-ID: <20260205202551.GE3520958@port70.net> Date: Thu, 5 Feb 2026 21:25:51 +0100 From: Szabolcs Nagy <nsz@...t70.net> To: Damian McGuckin <damianm@....com.au> Cc: MUSL <musl@...ts.openwall.com> Subject: Re: Slightly faster 'scalbn(x,i) = x*2**i' * Damian McGuckin <damianm@....com.au> [2026-02-01 10:55:08 +1100]: > > 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. nice > > 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. well it's not critical, but it also does not hurt to have the code on the list for future reference since you already spent time on it. > > 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.