Yo Mark! On Wed, 13 Sep 2017 22:31:31 +0000 Mark Atwood via devel <devel@ntpsec.org> wrote:
> How much complexity would it add to add the missing fp functions in > the same way the strlcpy function is? I think all we need for NetBSD 6.1 is ldexpl(). Here is one way, a very slow way, to do it: long double ldexpl(long double value, int e) { if (value == 0 || value == INFINITY || value == -INFINITY || value != value) { // Return +0.0/-0.0, +INF/-INF and NaN as-is } else { while (e > 0) value = value * 2, e--; while (e < 0) value = value * 0.5f, e++; // won't round denormals correctly } return value; } Ripped from: https://github.com/alexfru/SmallerC/blob/master/v0100/srclib/ldexp.c NTPsec only uses 32 and -32 values for 'e', so some simplification possible. The INF tests should likely be replaced with isfinite(). RGDS GARY --------------------------------------------------------------------------- Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703 g...@rellim.com Tel:+1 541 382 8588 Veritas liberabit vos. -- Quid est veritas? "If you can’t measure it, you can’t improve it." - Lord Kelvin
pgpPHyI396K0p.pgp
Description: OpenPGP digital signature
_______________________________________________ devel mailing list devel@ntpsec.org http://lists.ntpsec.org/mailman/listinfo/devel