aboutsummaryrefslogtreecommitdiff
path: root/lib/msun
Commit message (Collapse)AuthorAgeFilesLines
* Enable long double tests on RISC-VMitchell Horne2020-06-241-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | Some of the NetBSD contributed tests are gated behind the __HAVE_LONG_DOUBLE flag. This flag seems to be defined only for platforms whose long double is larger than their double. I could not find this explicitly documented anywhere, but it is implied by the definitions in NetBSD's sys/arch/${arch}/include/math.h headers, and the following assertion from the UBSAN code: #ifdef __HAVE_LONG_DOUBLE long double LD; ASSERT(sizeof(LD) > sizeof(uint64_t)); #endif RISC-V has 128-bit long doubles, so enable the tests on this platform, and update the comments to better explain the purpose of this flag. Reviewed by: ngie MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25419 Notes: svn path=/head/; revision=362576
* Remove tests for obsolete compilers in the build systemEric van Gyzen2020-05-121-2/+2
| | | | | | | | | | | | | | Assume gcc is at least 6.4, the oldest xtoolchain in the ports tree. Assume clang is at least 6, which was in 11.2-RELEASE. Drop conditions for older compilers. Reviewed by: imp (earlier version), emaste, jhb MFC after: 2 weeks Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D24802 Notes: svn path=/head/; revision=360964
* Fix typoSergio Carlavilla Delgado2020-04-041-1/+1
| | | | Notes: svn path=/head/; revision=359629
* Note some functions that appeared in First Edition UnixWarner Losh2020-04-013-3/+18
| | | | | | | | | These functions first appeared in the First Edition of Unix (or earlier in the pdp-7 version). Just claim 1st Edition for all this. The pdp-7 code is too fragmented at this point to extend history that far back. Notes: svn path=/head/; revision=359547
* msun: swap words order instead of bits order on BIG ENDIANAlfredo Dal'Ava Junior2020-03-261-4/+5
| | | | | | | | | | | | | | | | | The "for" loop on big endian was inverting all the bits instead of just the words Issue reported by TestSuite (msun lib nan_test case) Submitted by: Renato Riolino <renato.riolino@eldorado.org.br> Submitted by: Fernando Valle <fernando.valle@eldorado.org.br> Reviewed by: pfg, alfredo Approved by: jhibbits (mentor) Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D23926 Notes: svn path=/head/; revision=359342
* Add HISTORY sections to log(3) man pageSergio Carlavilla Delgado2020-03-261-1/+12
| | | | | | | | | | | PR: 240265 Submitted by: gbergling@gmail.com Approved by: bcr@(mentor), imp@ MFC after: 1 day Differential Revision: https://reviews.freebsd.org/D24148 Notes: svn path=/head/; revision=359326
* Temporarily skip 2 failing tests after llvm10 importLi-Wen Hsu2020-03-111-0/+3
| | | | | | | | PR: 244732 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=358887
* Remove sparc64 specific parts of libm and fix commentsWarner Losh2020-02-269-413/+17
| | | | | | | | | | | | | | | | Once upon a time, sparc64 was the only ld128 architecture. However, both aarch64 and riscv are now such architectures. Many of the comments about how slow multiplication was on old sparc64 processors are now no longer true. However, since no evaluation has been done for aarch64 yet, it's unclear if they are still relevant or not. If not, the code should be changed. If so, the comments should remove the uncertainty. Reviewed by: emaste@ Differential Revision: https://reviews.freebsd.org/D23658 Notes: svn path=/head/; revision=358347
* Add some HISTORY sections to manpagesSergio Carlavilla Delgado2020-02-191-1/+4
| | | | | | | | | | | | | | | | | environ(7) was in AT&T Version 7 ac(8): Add a HISTORY section sa(8): Add a HISTORY section sqrt(3): Add the actual sqrt function to the HISTORY section Obtained from: OpenBSD Submitted by: gbergling@gmail.com Approved by: bcr@(mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D23693 Notes: svn path=/head/; revision=358099
* [PowerPC] Fix feholdexcept() on powerpc referencing the wrong struct memberBrandon Bergren2020-02-021-1/+1
| | | | | | | | | | | | | In r355656, endianness handling of the floating point environment was fixed in the PowerPC code to work as intended. However, one bit got missed, causing feholdexcept() to mis-save the fenv. Submitted by: Renato Riolino <renato.riolino@eldorado.org.br> Differential Revision: https://reviews.freebsd.org/D23382 Notes: svn path=/head/; revision=357418
* msun: drop clause 3 from the Berkeley license.Pedro F. Giffuni2019-12-273-18/+6
| | | | | | | | | | | Per the University California Regents letter, drop the so-called "advertisement" clause. Discussed with: bde, kargl (2017) Differential Revision: https://reviews.freebsd.org/D22928 Notes: svn path=/head/; revision=356106
* [PowerPC] Fix SPE floating point environment manipulationBrandon Bergren2019-12-121-26/+31
| | | | | | | | | | | | | | | Fix multiple problems in the powerpcspe floating point code. * Endianness handling of the SPEFSCR in fenv.h was completely broken. * Ensure SPEFSCR synchronization requirements are being met. The __r.__d -> __r transformations were written by jhibbits. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22526 Notes: svn path=/head/; revision=355656
* Update Makefile.depend filesSimon J. Gerraty2019-12-111-1/+0
| | | | | | | | | | | | | Update a bunch of Makefile.depend files as a result of adding Makefile.depend.options files Reviewed by: bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22494 Notes: svn path=/head/; revision=355617
* The fdlibm hypot() implementations shouldn't potentially left-shiftDimitry Andric2019-11-262-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | negative numbers (invoking undefined behavior) Summary: Various paths through hypot(x, y) will multiply x and y by a power of two, perform the calculation in a range where IEEE-754 provides greater precision, then undo the multiplication to determine the true result. Undoing that multiplication is implemented as t1*w, where t1=2**k. 2**k is often computed by taking the high word of 1.0, then adding k<<20 (for doubles or long doubles) or k<<23 (for floats) to it, then overwriting that high word. But when k is negative this left-shifts a negative value -- and that's undefined behavior in many editions of C and C++. This patch should fix all hypot implementations to compute 2**k without triggering this particular bit of undefined behavior. Test Plan: I've only very lightly tested out the hypot(double, double) change, in SpiderMonkey's JavaScript engine, for consistency with prior behavior. The other functions' changes have more or less only been eyeballed. Careful examination appreciated! Do note, however, that an error in any of these changes would most likely produce a value that is incorrect by a factor of two, so any mistake would most likely be glaring if invoked. Submitted by: Jeff Walden <jwalden@mit.edu> Obtained from: https://github.com/freebsd/freebsd/pull/414 Reviewed by: dim, lwhsu MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22354 Notes: svn path=/head/; revision=355120
* Get the fix in back by reverting the part accidentally included in r354491.Li-Wen Hsu2019-11-071-2/+2
| | | | | | | | | | This brings back r354467. MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354520
* libcompat: build 32-bit rtld and ldd as part of "everything"Brooks Davis2019-11-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included directly so MD paths in Makefiles work. In the process centralize setting them in LIBCOMPATWMAKEENV. Alter .PATH and CFLAGS settings in work when the Makefile is included. While here only support LIB32 on supported platforms rather than always enabling it and requiring users of MK_LIB32 to filter based TARGET/MACHINE_ARCH. The net effect of this change is to make Makefile.libcompat only build compatability libraries. Changes relative to r354449: Correct detection of the compiler type when bsd.compat.mk is used outside Makefile.libcompat. Previously it always matched the clang case. Set LDFLAGS including the linker emulation for mips where -m32 seems to be insufficent. Reviewed by: imp, kib (origional version in r354449) Obtained from: CheriBSD (conceptually) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22251 Notes: svn path=/head/; revision=354491
* Fix declaration of S1 by swapping misplaced ',' and ';'.Brooks Davis2019-11-071-2/+2
| | | | | | | | | Reported by: kargl Obtained from: OpenBSD (tb@openbsd.org) MFC after: 1 week Notes: svn path=/head/; revision=354467
* Revert change accidentally included in r354465.Brooks Davis2019-11-071-2/+2
| | | | | | | Will recommit with a proper commit message shortly. Notes: svn path=/head/; revision=354466
* Revert r354449: libcompat: build 32-bit rtld and ldd as part of "everything"Brooks Davis2019-11-071-2/+2
| | | | | | | Additional testing is required.. Notes: svn path=/head/; revision=354465
* Add __isnan()/__isnanf() aliases for compatibility with glibc and CUDADimitry Andric2019-11-022-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Even though clang comes with a number of internal CUDA wrapper headers, compiling sample CUDA programs will result in errors similar to: In file included from <built-in>:1: In file included from /usr/lib/clang/9.0.0/include/__clang_cuda_runtime_wrapper.h:204: /usr/home/arr/cuda/var/cuda-repo-10-0-local-10.0.130-410.48/usr/local/cuda-10.0//include/crt/math_functions.hpp:2910:7: error: no matching function for call to '__isnan' if (__isnan(a)) { ^~~~~~~ /usr/lib/clang/9.0.0/include/__clang_cuda_device_functions.h:460:16: note: candidate function not viable: call to __device__ function from __host__ function __DEVICE__ int __isnan(double __a) { return __nv_isnand(__a); } ^ CUDA expects __isnan() and __isnanf() declarations to be available, which are glibc specific extensions, equivalent to the regular isnan() and isnanf(). To provide these, define __isnan() and __isnanf() as aliases of the already existing static inline functions __inline_isnan() and __inline_isnanf() from math.h. Reported by: arrowd PR: 241550 MFC after: 1 week Notes: svn path=/head/; revision=354255
* libm: Add missing END() directives for amd64 routinesConrad Meyer2019-10-239-0/+9
| | | | | | | | | No functional change. Related to D22122. Reviewed by: emaste, kib (earlier version both) Notes: svn path=/head/; revision=353929
* msun: Silence new harmless -Wimplicit-int-float-conversion warningsBrooks Davis2019-10-081-3/+3
| | | | | | | | | | | | | | | | Clang from trunk recently added a warning for when implicit int-to-float conversions cause a loss of precision. The code in question is designed to be able to handle that, so add explicit casts to silence this. Submitted by: James Clarke <jrtc27@jrtc27.com> Reviewed by: dim Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21913 Notes: svn path=/head/; revision=353329
* Do not left-shift a negative number (inducing undefined behavior inDimitry Andric2019-09-254-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C/C++) in exp(3), expf(3), expm1(3) and expm1f(3) during intermediate computations that compute the IEEE-754 bit pattern for |2**k| for integer |k|. The implementations of exp(3), expf(3), expm1(3) and expm1f(3) need to compute IEEE-754 bit patterns for 2**k in certain places. (k is an integer and 2**k is exactly representable in IEEE-754.) Currently they do things like 0x3FF0'0000+(k<<20), which is to say they take the bit pattern representing 1 and then add directly to the exponent field to get the desired power of two. This is fine when k is non-negative. But when k<0 (and certain classes of input trigger this), this left-shifts a negative number -- an operation with undefined behavior in C and C++. The desired semantics can be achieved by instead adding the possibly-negative k to the IEEE-754 exponent bias to get the desired exponent field, _then_ shifting that into its proper overall position. (Note that in case of s_expm1.c and s_expm1f.c, there are SET_HIGH_WORD and SET_FLOAT_WORD uses further down in each of these files that perform shift operations involving k, but by these points k's range has been restricted to 2 < k <= 56, and the shift operations under those circumstances can't do anything that would be UB.) Submitted by: Jeff Walden, https://github.com/jswalden Obtained from: https://github.com/freebsd/freebsd/pull/411 Obtained from: https://github.com/freebsd/freebsd/pull/412 MFC after: 3 days Notes: svn path=/head/; revision=352710
* Unskip test cases from netbsd-tests by defining __HAVE_FENVLi-Wen Hsu2019-08-311-0/+2
| | | | | | | | | | | | | | | This unskips: - lib.libc.stdlib.strtod_test.strtod_round - lib.msun.fe_round_test.t_nofe_round In lib/msun/tests/Makefile only define on fe_round_test.c because lib.msun.ilogb_test.ilogb will get wrong results and needs more examination. MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351648
* Introduce <sys/qmath.h>, a fixed-point math library from Netflix.
Edward Tomasz Napierala2019-08-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This makes it possible to perform mathematical operations
on fractional values without using floating point. It operates on Q numbers, which are integer-sized, opaque structures initialized to hold a chosen number of integer and fractional
bits.
 For a general description of the Q number system, see the "Fixed Point Representation & Fractional Math" whitepaper[1]; for the actual API see the qmath(3) man page. This is one of dependencies for the upcoming stats(3) framework[2] that will be applied to the TCP stack in a later commit. 1. https://www.superkits.net/whitepapers/Fixed%20Point%20Representation%20&%20Fractional%20Math.pdf 2. https://reviews.freebsd.org/D20477 Reviewed by: bcr (man pages, earlier version), sef (earlier version) Discussed with: cem, dteske, imp, lstewart Sponsored By: Klara Inc, Netflix Obtained from: Netflix Differential Revision: https://reviews.freebsd.org/D20116 Notes: svn path=/head/; revision=351544
* Partially revert r271349, which disabled the msun cexp test #4 on i386.Dimitry Andric2019-06-011-11/+15
| | | | | | | | | | | | | | | | Ensure the expected result is stored first in a volatile variable with the desired type. This makes all the tests succeed. Slightly changed from the original pull request, but functionally the same. Obtained from: https://github.com/freebsd/freebsd/pull/401 Submitted by: Moritz Buhl <gh@moritzbuhl.de> PR: 191676 MFC after: 3 days Notes: svn path=/head/; revision=348500
* Replace calls to sin(x) and cos(x) with a single call to sincos().Peter Jeremy2019-02-105-26/+20
| | | | | | | | | | | | Replace calls to sinf(x) and cosf(x) with a single call to sincosf(). Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu> Reviewed by: bde Approved by: grog MFC after: 3 days Notes: svn path=/head/; revision=343953
* Amend r343442, by only expecting the lib.msun.cbrt_test.cbrtl_powl andDimitry Andric2019-02-081-1/+2
| | | | | | | | | | | | | trig_test.reduction test cases to fail, if the fixes from r343916 have not yet been applied to the base compiler. Reported by: lwhsu PR: 234040 Upstream PR: https://bugs.llvm.org/show_bug.cgi?id=40206 MFC after: 1 week Notes: svn path=/head/; revision=343917
* libm: squelch -Woverflow from gcc6Eric van Gyzen2019-02-011-0/+9
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=343671
* Temporarily mark lib.msun.{cbrt_test.cbrtl_powl,trig_test.reduction}Li-Wen Hsu2019-01-251-0/+4
| | | | | | | | | | | | | expected failure after clang700-import merge PR: 234040 Reviewed by: ngie, markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18938 Notes: svn path=/head/; revision=343442
* msun: reduce diff between src/e_j0.c and src/e_j0f.cPedro F. Giffuni2019-01-142-10/+12
| | | | | | | | PR: 229501 MFC after: 1 week Notes: svn path=/head/; revision=343023
* pow(3): Workaround possible signed shift Undefined Behavior.Pedro F. Giffuni2019-01-071-1/+1
| | | | | | | | | | j is int32_t and thus j<<31 is undefined if j==1. Hinted by: muusl-lib (git 688d3da0f1730daddbc954bbc2d27cc96ceee04c) Discussed with: freebsd-numerics (kargl) Notes: svn path=/head/; revision=342851
* msun: Fix some old typos.Pedro F. Giffuni2018-12-312-2/+2
| | | | | | | Seen in a posting from July 27 by "CM Graff" in musl-libc. Notes: svn path=/head/; revision=342651
* libm: Include float.h to get LDBL_MANT_DIGJustin Hibbits2018-12-283-1/+3
| | | | | | | | | | | | | | The long double aliases of double functions are only exposed as aliases if LDBL_MANT_DIG is 53 (same as DBL_MANT_DIG). Without float.h included these files were not exposing weak aliases as expected, leading to link failures if programs use the *l functions. This should fix editors/calligra on targets with 64-bit long double, which uses erfl and erfcl. Found on powerpc64. Reviewed by: kargl@ Notes: svn path=/head/; revision=342563
* csqrt(3): Fix some typos in the manual pageMateusz Piotrowski2018-11-041-2/+2
| | | | | | | | | | Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu> Reviewed by: eadler Approved by: krion (mentor, implicit), mat (mentor, implicit) Differential Revision: https://reviews.freebsd.org/D17831 Notes: svn path=/head/; revision=340115
* In C remquol() and thus also in C remainderl(), don't clobber the sign bitBruce Evans2018-07-241-6/+1
| | | | | | | | | | | | | | | | of NaNs before possible returning a NaN. The remquo*() and remainder*() functions should now give bitwise identical results across arches and implementations, and bitwise consistent results (with lower precisions having truncated mantissas) across precisions. x86 already had consistency across amd64 and i386 and precisions by using the i387 consistently and normally not using the C versions. Inconsistencies for C reqmquol() were first detected on sparc64. Remove double second clearing of the sign bit and extra blank lines. Notes: svn path=/head/; revision=336665
* Fix the conversion to use nan_mix() in r336362. fmod*(x, y),Bruce Evans2018-07-249-16/+23
| | | | | | | | | | | | | | | | | | remainder*(x, y) and remquo*(x, y, quo) were broken for y = 0 by changing multiplication by y to addition of y. (When y is 0, the result should be NaN but became 1 for finite x.) Use a new macro nan_mix_op() to give more control over the mixing, and expand comments. Recent re-testing missed finding this bug since I only tested the macro version on amd64 and i386 and these arches don't use the C versions (they use either asm versions or builtins). Reported by: enh via freebsd-numerics Notes: svn path=/head/; revision=336663
* Recommit r336497: Fix powl, cpow, cpowf, and cpowl imports from OpenBSDDimitry Andric2018-07-208-125/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a follow-up to r336299. * lib/msun/Makefile: . Remove polevll.c * lib/msun/ld80/e_powl.c: . Copy contents of polevll.c to here. This is the only consumer of these functions. Make functions 'static inline'. . Make reducl a 'static inline' function. * lib/msun/man/exp.3: . Remove BUGS section that no longer applies. * lib/msun/src/math_private.h: . Remove prototypes of __p1evll() and __polevll() * lib/msun/src/s_cpow.c: * lib/msun/src/s_cpowf.c: * lib/msun/src/s_cpowl.c . Include math_private.h. . Use the CMPLX macro from either C99 or math_private.h (depends on compiler support) instead of the problematic use of complex I. Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu> PR: 229876 MFC after: 1 week Notes: svn path=/head/; revision=336563
* Centralize the complications for special efficient rounding to integers.Bruce Evans2018-07-209-75/+93
| | | | | | | | | | | | | | | | | | | | | | | | This was open-coded in range reduction for trig and exp functions. Now there are 3 static inline functions rnint[fl]() that replace open-coded expressions, and type-generic irint() and i64rint() macros that hide the complications for efficiently using non-generic irint() and irintl() functions and casts. Special details: ld128/e_rem_pio2l.h needs to use i64rint() since it needs a 46-bit integer result. Everything else only needs a (less than) 32-bit integer result so uses irint(). Float and double cases now use float_t and double_t locally instead of STRICT_ASSIGN() to avoid bugs in extra precision. On amd64, inline asm is now only used for irint() on long doubles. The SSE asm for irint() on amd64 only existed because the ifdef tangles made the correct method of simply casting to int for this case non-obvious. Notes: svn path=/head/; revision=336545
* Revert r336497 for now, as it breaks on architectures using gcc, with:Dimitry Andric2018-07-198-55/+125
| | | | | | | | | cc1: warnings being treated as errors /usr/src/lib/msun/src/s_cpow.c: In function 'cpow': /usr/src/lib/msun/src/s_cpow.c:63: warning: implicit declaration of function 'CMPLX' Notes: svn path=/head/; revision=336500
* Fix powl, cpow, cpowf, and cpowl imports from OpenBSDDimitry Andric2018-07-198-125/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a follow-up to r336299. * lib/msun/Makefile: . Remove polevll.c * lib/msun/ld80/e_powl.c: . Copy contents of polevll.c to here. This is the only consumer of these functions. Make functions 'static inline'. . Make reducl a 'static inline' function. * lib/msun/man/exp.3: . Remove BUGS section that no longer applies. * lib/msun/src/math_private.h: . Remove prototypes of __p1evll() and __polevll() * lib/msun/src/s_cpow.c: * lib/msun/src/s_cpowf.c: * lib/msun/src/s_cpowl.c . Use the CMPLX macro from either C99 or math_private.h (depends of compiler support) instead of the problematic use of complex I. Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu> PR: 229876 MFC after: 1 week Notes: svn path=/head/; revision=336497
* Fix spurious and extra underflows and resulting inaccuracies for some casesBruce Evans2018-07-192-10/+10
| | | | | | | | | | | | with 1 huge component and 1 tiny (but nowhere near denormal) component. Rescale earlier so that a scale factor of 2 can be combined with a non- scale divisor of 2, so that the division doesn't shift out a bit. In the usual case where the scale factor is just 1, the division may shift out a bit, but then the underflow is not spurious and the inaccuracies are harder to fix. Notes: svn path=/head/; revision=336488
* Oops, r336412 undid the fix of the overflow threshold in r323003. RestoreBruce Evans2018-07-191-6/+11
| | | | | | | the previous overflow threshold and adjust comments. Notes: svn path=/head/; revision=336484
* Minor cleanups to csqrt*(), mostly in comments.Bruce Evans2018-07-173-36/+14
| | | | | | | | | | | | Remove the STDC CX_LIMITED_RANGE pragma and its verbose comment. We still don't have any C99 compilers (that support fenv pragmas), and if we did then there are thousands of other places in libm that would need to use them more than here. The other cleanups are smaller. Notes: svn path=/head/; revision=336412
* Fix scaling bugs which gave innaccuracies and spurious underflows in csqrt()Bruce Evans2018-07-172-28/+48
| | | | | | | | | | | | | | | | | | | and csqrtl(). When one component is huge and the other is tiny, scaling down the tiny component gave spurious underflow. When both components are denormal, not scaling them up gave inaccuracies of 34+ ulps on not very carefully selected args. Fixing this reduces the maximum error to 1.6 ulps on the same set of args (mosly not denormal ones). The scaling used multiplication of a complex variable by 2, but clang messes this on amd64 up by losing the sign of -0.0. Calculate the components separately, as is well known to be needed for operations on more exceptional values. Notes: svn path=/head/; revision=336400
* Add a macro nan_mix() and use it to get NaN results that are (bitwise)Bruce Evans2018-07-1731-55/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | independent of the precision in most cases. This is mainly to simplify checking for errors. r176266 did this for e_pow[f].c using a less refined expression that often didn't work. r176276 fixes an error in the log message for r176266. The main refinement is to always expand to long double precision. See old log messages (especially these 2) and the comment on the macro for more general details. Specific details: - using nan_mix() consistently for the new and old pow*() functions was the only thing needed to make my consistency test for powl() vs pow() pass on amd64. - catrig[fl].c already had all the refinements, but open-coded. - e_atan2[fl].c, e_fmod[fl].c and s_remquo[fl] only had primitive NaN mixing. - e_hypot[fl].c already had a different refined version of r176266. Refine this further. nan_mix() is not directly usable here since we want to clear the sign bit. - e_remainder[f].c already had an earlier version of r176266. - s_ccosh[f].c,/s_csinh[f].c already had a version equivalent to r176266. Refine this further. nan_mix() is not directly usable here since the expression has to handle some non-NaN cases. - s_csqrt.[fl]: the mixing was special and mostly wrong. Partially fix the special version. - s_ctanh[f].c already had a version of r176266. Notes: svn path=/head/; revision=336362
* msun: add ld80/ld128 powl, cpow, cpowf, cpowl from openbsdMatt Macy2018-07-1513-16/+1507
| | | | | | | | | | | | | | | | | | | | | | This corresponds to the latest status (hasn't changed in 9+ years) from openbsd of ld80/ld128 powl, and source cpowf, cpow, cpowl (the complex power functions for float complex, double complex, and long double complex) which are required for C99 compliance and were missing from FreeBSD. Also required for some numerical codes using complex numbered Hamiltonians. Thanks to jhb for tracking down the issue with making weak_reference compile on powerpc. When asked to review, bde said "I don't like it" - but provided no actionable feedback or superior implementations. Discussed with: jhb Submitted by: jmd Differential Revision: https://reviews.freebsd.org/D15919 Notes: svn path=/head/; revision=336299
* Reduce diff between msun/src/e_pow.c and msun/src/e_powf.c.Mark Johnston2018-07-082-8/+14
| | | | | | | | | | | | | Remove unnecessary casts, use integer literal constants instead of floating point constants where possible, and introduce three const static variables to hold 0.5, 0.25, and 1/3. PR: 229420 Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu> MFC after: 1 week Notes: svn path=/head/; revision=336090
* Fix whitespace issues in bessel function routines.Mark Johnston2018-07-084-40/+36
| | | | | | | | | PR: 229423 Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu> MFC after: 3 days Notes: svn path=/head/; revision=336089
* clog.3, complex.3: Fix typos and igor style issuesConrad Meyer2018-06-062-14/+12
| | | | | | | | PR: 228783 Reported by: Karsten <freebsd-bugzilla AT kkoenig.net> Notes: svn path=/head/; revision=334721