NetBSD, llround, pivot, testing

Achim Gratz Stromeko at nexgo.de
Sat May 6 08:49:05 UTC 2017


Hal Murray via devel writes:
> commit 194cbd22565ae49dde0d70b9d47033e50edb097d
> Author: Gary E. Miller <gem at rellim.com>
> Date:   Thu Apr 6 19:09:04 2017 -0700
>     Fix 120 warnings, and round on conversion from double to l_fp.
>
> -       return (l_fp)((int64_t)ldexp(d, 32));
> +       return (l_fp)(llround(ldexp(d, 32)));

It's not supposed to do any rounding, the original function that I
simplified to the casted ldexp expression was truncating to the integer
seconds.  The old code also worked around some problem with the cast not
working correctly for negative numbers, which can only happen for _very_
old compilers implementing their own FP (instead of using the FPU) and
is something C99 mandates to work anyway.

The bad function cast warning is absolutely stupid and should be
switched off, since it warns about something that is intended to happen
(and a bit difficult to get at otherwise, since it's part of the
language standard, so no library re-implements it).


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds



More information about the devel mailing list