From: Alan Cox Date: Mon, 5 Mar 2018 20:26:05 +0000 (+0000) Subject: cbrt: make it friendly with non 64bit capable X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=439053ac840e0b920e51e42afc8f8a8320926942;p=FUZIX.git cbrt: make it friendly with non 64bit capable --- diff --git a/Library/libs/cbrt.c b/Library/libs/cbrt.c index 3a310f38..353cb4ee 100644 --- a/Library/libs/cbrt.c +++ b/Library/libs/cbrt.c @@ -93,7 +93,14 @@ double cbrt(double x) * before the final error is larger than 0.667 ulps. */ u.value = t; +#ifdef NO_64BIT + if (u.bits[LOBIT] & 0x80000000UL) + u.bits[HIBIT]++; + u.bits[LOBIT] ^= 0x80000000UL; + u.bits[LOBIT] &= 0xC0000000UL; +#else u.bits = (u.bits + 0x80000000) & 0xffffffffc0000000ULL; +#endif t = u.value; /* one step Newton iteration to 53 bits with error < 0.667 ulps */