aboutsummaryrefslogtreecommitdiff
path: root/lib/msun
Commit message (Collapse)AuthorAgeFilesLines
* libm: remainder: make sure x is zeroAhmad Khalifa2025-10-111-2/+2
| | | | | | | | | | | | Make sure the entirety of x is zero before flipping the sign bit. Otherwise the sign would be wrong for small values of x when x is negative and |n*y| > |x| Reported by: alfredo PR: 251091 Reviewed by: kargl MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D53023
* lib/msun: cpow{,f,l}(CMLX(0.0, 0.0)) should return 1.0Steve Kargl2025-09-123-3/+12
| | | | | PR: 289447 MFC after: 1 week
* [libm] Avoid left shift of signed integer entitiesSteve Kargl2025-08-144-17/+36
| | | | | | | | | | | | | | | | | | | | | | | | Follow-up commit d180086e6eae by fixing the left shift of signed integer entities through the use of a helper function. Specific per file changes are: * lib/msun/src/e_fmodf.c: * lib/msun/src/s_remquof.c: . Eliminate now unused variable 'i'. . Sort declaration statement. . Use subnormal_ilogbf() to avoid left shift of signed integer. * lib/msun/src/math_private.h b/lib/msun/src/math_private.h: . Implement subnormal_ilogbf() to extract an exponent of a subnormal float. This avoids left shifts of signed integers. . Update nearby comment. * lib/msun/src/s_ilogbf.c . Fix declaration of the function statement in accordance with style(9). . Use subnormal_ilogbf() to avoid left shift of signed integer. PR: 288850 MFC after: 1 week
* [libm] Fix undefined behavior of a left shifted of a signed integerSteve Kargl2025-08-124-44/+50
| | | | | | | | | | | | | | | | | | | | | The patch fixes a few instances of left shifts on signed integer entities. A 'static inline' helper function 'subnormal_ilogb()' has been added to math_private.h. This function is then used e_fmod.c, s_ilogb(), and s_remquo.c. The change in s_remquo.c has only been compile tested. The change to e_fmod.c has been test on over 3 billion pairs of subnormal numbers where testing included x > y and x < y pairs. The test compared the output from fmod() with the output from mpfr_fmod() from MPFR. There were no difference. The change to s_ilogb() has had limited testing where its output was compared against frexp(). In this testing, no differences in output were detected. PR: 288778 MFC after: 1 week
* Updates for ccosh[f] and csinh[f]Steve Kargl2025-08-094-28/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/msun/src/s_ccosh.c: . Update Copyright years. . sin() and cos() are needed at the same time, so use sincos() to compute values. This does argument reduction once instead of twice. . Replace '* 0.5' with '/ 2'. This reduces diff with s_ccoshf.c. . For (LDBL_MANT_DIG == 53), add weak references for ccoshl and ccosl. * lib/msun/src/s_ccoshf.c: . Update Copyright years. . sin() and cos() are needed at the same time, so use sincos() to compute values. This does argument reduction once instead of twice. . Replace '* 0.5F' with '/ 2'. This reduces diff with s_ccoshf.c. * lib/msun/src/s_csinh.c: . Update Copyright years. . sin() and cos() are needed at the same time, so use sincos() to compute values. This does argument reduction once instead of twice. . Replace '* 0.5' with '/ 2'. This reduces diff with s_csinhf.c. . For (LDBL_MANT_DIG == 53), add weak references for csinhl and csinl. * lib/msun/src/s_csinhf.c: . Update Copyright years. . sin() and cos() are needed at the same time, so use sincos() to compute values. This does argument reduction once instead of twice. . Replace '* 0.5F' with '/ 2'. This reduces diff with s_ccoshf.c. PR: 288740 MFC after: 1 week
* Remove unused variables in msun/bsdsrc/b_tgamma.cSteve Kargl2025-08-091-1/+1
| | | | | PR: 288736 MFC after: 3 days
* fix build after _types.h changesBrooks Davis2025-06-121-0/+1
| | | | | Reported by: imp, Jenkins CI Fixes: b01e971fd39d ("Don't rely on sys/_types.h including sys/cdefs.h")
* arm: fix build after _types.h changesBrooks Davis2025-06-122-0/+2
| | | | | Reported by: alc Fixes: b01e971fd39d ("Don't rely on sys/_types.h including sys/cdefs.h")
* Don't rely on sys/_types.h including sys/cdefs.hBrooks Davis2025-06-111-0/+1
| | | | | | | | | | These headers relied in __BEGIN_DECS/__END_DECLS being defined when sys/_types.h was included, but there's not a requirement that this be the case. Reviewed by: imp Exp-run by: antoine (PR 286274) Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
* msun: fix cbrt iterations from Newton to Halley methodClément Bœsch2025-05-053-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we're inverting a cube, we have: f(Tₙ)=Tₙ³-x (1) Its first and second derivatives are: f'(Tₙ)=3Tₙ² (2) f"(Tₙ)=6Tₙ (3) Halley iteration[1] uses: Tₙ₊₁=Tₙ-2f(Tₙ)f'(Tₙ)/(2f'(Tₙ)²-f(Tₙ)f"(Tₙ)) (4) Replacing the terms of (4) using (1), (2) and (3): Tₙ₊₁ = Tₙ-2f(Tₙ)f'(Tₙ)/(2f'(Tₙ)²-f(Tₙ)f"(Tₙ)) = Tₙ-2(Tₙ³-x)3Tₙ²/(2(3Tₙ²)²-(Tₙ³-x)6Tₙ) = <snip, see WolframAlpha[2] alternate forms> = Tₙ(2x+Tₙ³)/(x+2Tₙ³) This formula corresponds to the exact expression used in the code. Newton formula is Tₙ-f(Tₙ)/f'(Tₙ) which would have simplified to (2Tₙ³+x)/(3Tₙ²) instead. [1] https://en.wikipedia.org/wiki/Halley's_method [2] https://www.wolframalpha.com/input?i=T-2%28T%5E3-x%293T%5E2%2F%282%283T%5E2%29%5E2-%28T%5E3-x%296T%29 Note: UTF8 in commit message due to the heavy math being hard to recreate w/o it. -- imp Signed-off-by: Clément Bœsch <u@pkh.me> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1684
* manuals: Fix some .Bl -tag listsGraham Percival2024-11-183-33/+18
| | | | | | | | Signed-off-by: Graham Percival <gperciva@tarsnap.com> Reviewed by: mhorne, Alexander Ziaee <concussious.bugzilla@runbox.com> MFC after: 3 days Sponsored by: Tarsnap Backup Inc. Pull Request: https://github.com/freebsd/freebsd-src/pull/1528
* Update Makefile.depend filesSimon J. Gerraty2024-10-141-1/+0
| | | | | | | After building packages we have a number of new and updated Makefile.depend files Reviewed by: stevek
* Improve accuracy of asinf(3) and acosf(3)Steve Kargl2024-08-292-15/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This uses a better rational approximation to improve the accuracy of both functions. For exhaustive testing of asinf(3) in the interval, the current libm gives: % ./tlibm asin -fPED -x 0x1p-12f -X 1 Interval tested for asinf: [0.000244141,1] ulp <= 0.5: 97.916% 98564994 | 97.916% 98564994 0.5 < ulp < 0.6: 2.038% 2051023 | 99.953% 100616017 0.6 < ulp < 0.7: 0.047% 47254 | 100.000% 100663271 0.7 < ulp < 0.8: 0.000% 25 | 100.000% 100663296 Max ulp: 0.729891 at 5.00732839e-01 which isn't too bad given that much of the computation is actually done in double floating point. With the new rational approximation, exhaustive testing yields: % ./tlibm asin -fPED -x 0x1p-12f -X 1 Interval tested for asinf: [0.000244141,1] ulp <= 0.5: 99.711% 100372643 | 99.711% 100372643 0.5 < ulp < 0.6: 0.288% 290357 | 100.000% 100663000 0.6 < ulp < 0.7: 0.000% 296 | 100.000% 100663296 Max ulp: 0.636344 at 5.09706438e-01 Similarly, for exhaustive testing of asinf(3) in the interval, the current libm gives: % ./tlibm acos -fPED -x -1 -X -0x1p-12f Interval tested for acosf: [-1,-0.000244141] ulp <= 0.5: 97.008% 97651921 | 97.008% 97651921 0.5 < ulp < 0.6: 2.441% 2457242 | 99.450% 100109163 0.6 < ulp < 0.7: 0.472% 475503 | 99.922% 100584666 0.7 < ulp < 0.8: 0.071% 71309 | 99.993% 100655975 0.8 < ulp < 0.9: 0.007% 7319 | 100.000% 100663294 0.9 < ulp < 1.0: 0.000% 2 | 100.000% 100663296 Max ulp: 0.914007 at -5.01484931e-01 % ./tlibm acos -fPED -x 0x1p-12f -X 1 Interval tested for acosf: [0.000244141,1] ulp <= 0.5: 97.317% 97962530 | 97.317% 97962530 0.5 < ulp < 0.6: 2.340% 2355182 | 99.657% 100317712 0.6 < ulp < 0.7: 0.314% 316134 | 99.971% 100633846 0.7 < ulp < 0.8: 0.029% 29450 | 100.000% 100663296 Max ulp: 0.796035 at 4.99814630e-01 With the new rational approximation, exhaustive testing yields: % ./tlibm acos -fPED -x -1 -X -0x1p-12f Interval tested for acosf: [-1,-0.000244141] ulp <= 0.5: 97.010% 97653245 | 97.010% 97653245 0.5 < ulp < 0.6: 2.442% 2458373 | 99.452% 100111618 0.6 < ulp < 0.7: 0.473% 476012 | 99.925% 100587630 0.7 < ulp < 0.8: 0.068% 68603 | 99.993% 100656233 0.8 < ulp < 0.9: 0.007% 7063 | 100.000% 100663296 Max ulp: 0.896189 at -5.04511118e-01 % ./tlibm acos -fPED -x 0x1p-12f -X 1 Interval tested for acosf: [0.000244141,1] ulp <= 0.5: 97.650% 98298175 | 97.650% 98298175 0.5 < ulp < 0.6: 2.028% 2041709 | 99.679% 100339884 0.6 < ulp < 0.7: 0.292% 293555 | 99.970% 100633439 0.7 < ulp < 0.8: 0.030% 29857 | 100.000% 100663296 Max ulp: 0.775875 at 4.91849005e-01 PR: 281001 MFC after: 1 week
* msun: Fix typo in commentSteve Kargl2024-08-211-1/+1
| | | | | PR: 280965 MFC after: 3 days
* msun/ld80/e_powl.c: make powl() thread-safe by making static variables ↵Konstantin Belousov2024-08-071-3/+3
| | | | | | | | | | thread-local Reported and tested by: Paul Zimmermann <Paul.Zimmermann@inria.fr> Reviewed by: imp Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D46237
* msun/ld80/e_powl.c: add const qualifiers to the static immutable valuesKonstantin Belousov2024-08-071-9/+9
| | | | | | | Reviewed by: imp Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D46237
* libm: fma: correct zero sign with small inputsSteve Kargl2024-07-282-4/+4
| | | | | | | | | This is a fixed version of 888796ade284. PR: 277783 Reported by: Victor Stinner Reviewed by: emaste MFC after: 1 week
* Remove residual blank line at start of MakefileWarner Losh2024-07-157-7/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* libm: add parens to clarify expressions in fma, fmalEd Maste2024-07-152-6/+6
| | | | Obtained from: NetBSD
* libmsun: remove duplicates after cdefs.h added inline to __always_inlineRyan Libby2024-06-256-6/+6
| | | | | | Reviewed by: kib, olce Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D45712
* erf.3: Add a STANDARDS sectionGordon Bergling2024-06-231-1/+12
| | | | | | | | | Add a STANDARDS section for the erf(3) manual page. PR: 273413 Reviewed by: pauamma_gundo.com MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D44140
* math.h: Remove support for old gcc versionsWarner Losh2024-06-211-6/+1
| | | | | | | | | | | Remove support for old gcc versions by unconditionally defining __MATH_BUILTIN_RELOPS and __MATH_BUILTIN_CONSTANTS. Per kib's request, don't #undef those so it's easier to understand what the builtins are doing. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D45655 Sponsored by: Netflix
* lib: Remove __ARM_ARCH checks that are always trueAndrew Turner2024-06-121-5/+1
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D45559
* Revert "libm: fma: correct zero sign with small inputs"Ed Maste2024-06-122-6/+2
| | | | | | | | | | | This change introduced a test failure, so revert until that can be addressed. This reverts commit 888796ade2842486d3167067e8034254c38aadd3. PR: 277783 Reported by: rlibby Sponsored by: The FreeBSD Foundation
* msun: update Clang bug reference in fma testEd Maste2024-06-122-4/+4
| | | | | | LLVM bugzilla bug 8100 became issue #8472 with the migration to GitHub. https://github.com/llvm/llvm-project/issues/8472
* libm: fma: correct zero sign with small inputsEd Maste2024-06-082-2/+6
| | | | | | | | PR: 277783 Reported by: Victor Stinner Submitted by: kargl MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D44433
* pow,powf(3),__ieee754_rem_pio2(f): Avoid negative integer left shift UBKarl Tomlinson2024-04-234-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | A compiler clever enough to know that z is positive with a non-zero biased exponent could, for example, optimize away the scalbnf(z,n) in pow() because behavior for left shift of negative values is undefined. `n` is negative when y*log2(|x|) < -0.5. i.e. |x^y| < sqrt(0.5) The intended behavior for operator<< in this code is to shift the two's complement representation of the first operand. In the pow() functions, the result is added to the IEEE 754 exponent of z = 2^y'. n may be negative enough to underflow the biased IEEE 754 exponent below zero, which is manifested in the sign bit of j (which would correspond to the IEEE 754 sign bit). The conversion from uint32_t to int32_t for out-of-int32_t-range values is implementation defined. The assumed behavior of interpreting the uint32_t value as a two's complement representation of a signed value is already assumed in many parts of the code, such as uses of GET_FLOAT_WORD() with signed integers. This code passes all the current tests, and makes some out of tree fuzzing tests pass again rather than hit UB (detailed in the commentary of the pull request). Signed-off-by: Karl Tomlinson <karlt+@karlt.net> Reviewed by: imp, steve kargl, dim Pull Request: https://github.com/freebsd/freebsd-src/pull/1137
* msun: Fix math error in comment explaining y reductionHenri Chataing2024-04-122-2/+2
| | | | | | | | | | | | | | | | | | x = k + y for some integer k and |y| < 1/2 exp2(x) = exp2(k + y) = exp2(k) * exp2(y) which can be written as 2**k * exp2(y) The original had x = 2**k + y, which is has an extra 2** in it which isn't correct. Confirmed by forumula 2 in Gal and Bachelis referenced in the comments for the source of this method https://dl.acm.org/doi/pdf/10.1145/103147.103151 The actual code is correct. Reviewed by: imp (who added s_exp2.c and wrote the commit message) Pull Request: https://github.com/freebsd/freebsd-src/pull/1127
* math: Add long double constant definitionsCollin Funk2024-04-121-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These constants are GNU libc extensions that are likely to be adopted by the next POSIX revision [1]. The definitions can be verified in a PARI-GP shell session: * M_El: exp (1) * M_LOG2El: log (exp (1)) / log (2) * M_LOG10El: log (exp (1)) / log (10) * M_LN2l: log (2) * M_LN10l: log (10) * M_PIl: Pi * M_PI_2l: Pi / 2 * M_PI_4l: Pi / 4 * M_1_PIl: 1 / Pi * M_2_PIl: 2 / Pi * M_2_SQRTPIl: 2 / sqrt (Pi) * M_SQRT2l: sqrt (2) * M_SQRT1_2l: 1 / sqrt (2) [1] https://austingroupbugs.net/view.php?id=828 Put these behind __BSD_VISIBLE || __XSI_VISIBLE >= 800 to future-proof these changes. They shouldn't be defined at lower levels of XSI, but don't have other XSI 800 stuff in place yet. Signed-off-by: Collin Funk <collin.funk1@gmail.com> Reviewed by: imp, allanjude Pull Request: https://github.com/freebsd/freebsd-src/pull/1121
* Now that D44168 has been merged to stable/14, update the manpageMark Murray2024-04-121-2/+2
| | | | to correctly reflect history.
* riscv: remove more riscv64sf supportBrooks Davis2024-03-213-37/+2
| | | | | | | | | | Remove a few more bits of riscv64sf support in libc and libm. Reduce floating point ABI checks to requiring double hard float. Reviewed by: imp, jhb Fixes: 1ca12bd927d7 Remove the riscv64sf architecture. Differential Revision: https://reviews.freebsd.org/D44334
* msun/riscv: expose fe{disable,enable}exceptBrooks Davis2024-03-212-10/+7
| | | | | | | | | This is required for GCC to build. PR: 272759 Reported by: dgilbert@eicat.ca Submitted by: jrtc27 Differential Revision: https://reviews.freebsd.org/D44333
* lib/msun: Fix tgammal(3) on IEEE 128-bit platformsMark Murray2024-03-183-59/+15
| | | | | | | | | | | | | | | | | | | | | | | Undo the 80-bit "stub" implementation of the 128-bit long double tgammal(3) function. The latest (as of Feb 2024) version of the src/contrib/arm-optimised-routines library includes a standalone, full 128-bit replacement. This needs a small bit of wrapping to fit it in, but is otherwise a drop-in replacement. Testing this is hard, as most maths packages blow up as soon as their 80-bit floating-point capability is exceeded. With 128-bit tgammal(), this is easy to do, and this is the range that needs to be checked the most carefully. Using my copy of Maple, I was able to check that the output was within a few ULP of the correct answer, right up to the point of 128-bit over- and underflow. Additionally, the results are no worse, and indeed better than the 80-bit version. Steve Kargl sent me his libm testing code, which I used to verify that the excpetions for certain key values were correct. Tested in this case were +-Inf, +-NaN, +-1 and +-0. Differential Revision: https://reviews.freebsd.org/D44168 Reviewed by: theraven, andrew, imp
* include/math.h: fix warning with -WconversionMartin Oliveira2024-02-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way the __fp_type_select macro uses the _Generic expression causes gcc to throw a warning on valid code if the -Wconversion flag is used. For example, consider the following program: #include <math.h> int main() { double x = 1.0; isnan(x); return 0; } which throws a warning: $ gcc -Wconversion a.c a.c:5:15: warning: conversion from 'double' to 'float' may change value [-Wfloat-conversion] 5 | isnan(x); | ^ This happens because the functions are invoked inside of the _Generic. Looking at the example of _Generic in the C11 specification, one sees that the parameters are outside of the _Generic expression (see page 79 here: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf). Reference: https://stackoverflow.com/a/68309379 Signed-off-by: Martin Oliveira <martin.oliveira@eideticom.com> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/841
* lib/msun: Cleanup after $FreeBSD$ removalSteve Kargl2024-01-28233-244/+0
| | | | | | | Remove no longer needed explicit inclusion of sys/cdefs.h. PR: 276669 MFC after: 1 week
* msun: remove fabs from Symbol.map, and adjust commentDimitry Andric2024-01-272-2/+2
| | | | | | | | | | | | | | | We have s_fabs.c, but fabs(3) is already provided by libc due to historical reasons, so it is not compiled into libm. When the linker does not use --undefined-version, this leads to a complaint about the symbol being nonexistent, so remove it from Symbol.map. While here, adjust the comment about some functions being supplied by libc: while it is true that all these are indeed in libc, libm still includes its own versions of frexp(3), isnan(3), isnanf(3), and isnanl(3). Reported by: Steve Kargl <sgk@troutmask.apl.washington.edu> MFC after: 3 days
* lib: Automated cleanup of cdefs and other formattingWarner Losh2023-11-2712-12/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* lib: Remove ancient SCCS tags.Warner Losh2023-11-27126-170/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* dirdeps: Update/fix Makefile.depend* for toolchainKa Ho Ng2023-11-271-0/+1
| | | | This fixes make pseudo/toolchain.
* math: Move to const instead of __constWarner Losh2023-11-201-3/+3
| | | | | | | | | There's no reason to use the __const construct here. This is a left-over from supporting K&R and ANSI compilers in the original Sun msun. All other K&R crutches have been removed. Remove these as well. There's no semantic difference. And there's already several others in math.h. Sponsored by: Netflix
* Purge more stray embedded $FreeBSD$ stringsJohn Baldwin2023-09-253-13/+0
| | | | | | | These do not use __FBSDID but instead use bare char arrays. Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D41957
* msun: LIBCSRCDIR is too fragile, use ${SRCTOP}/lib/libc insteadWarner Losh2023-09-051-5/+15
| | | | | | | | | | | | | | | LIBCSRCDIR is defined in bsd.libnames.mk, which is read in later in the Makefile than the line: .if exists(${LIBCSRCDIR}/${MACHINE_ARCH}) so we test to see if /${MARCHIN_ARCH} exists which it usually doesn't (but did for me since I mounted 13.2R SD image there). Move to defining our own LIBC_SRCTOP in terms of SRCTOP to treat these uniformily. Sponsored by: Netflix Reviewed by: sjg Differential Revision: https://reviews.freebsd.org/D41661
* Remove $FreeBSD$: one-line nroff patternWarner Losh2023-08-1633-33/+0
| | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: two-line nroff patternWarner Losh2023-08-1627-54/+0
| | | | Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-1610-10/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-16320-636/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-161-1/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-169-9/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-1641-82/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* Clean up libm use of the __ieee754_ prefixSteve Kargl2023-08-0354-223/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the __ieee754_ prefix from a number of the math functions. msun/src/math_private.h contains the statement that /* * ieee style elementary functions * * We rename functions here to improve other sources' diffability * against fdlibm. */ #define __ieee754_sqrt sqrt ... Here, fdlibm refers to https://netlib.org/fdlibm. It is seen from https://netlib.org/fdlibm/readme that this prefix was used to differentiate between different standards: Wrapper functions will twist the result of the ieee754 function to comply to the standard specified by the value of _LIB_VERSION if _LIB_VERSION = _IEEE_, return the ieee754 result; if _LIB_VERSION = _SVID_, return SVID result; if _LIB_VERSION = _XOPEN_, return XOPEN result; if _LIB_VERSION = _POSIX_, return POSIX/ANSI result. (These are macros, see fdlibm.h for their definition.) AFAICT, FreeBSD has never supported these wrappers. In addition, as C99, principally the long double, functions were added to libm, this convention was not maintained. Given that only 148 of 324 files under lib/msun contain a "Copyright (C) 1993 by Sun Microsystems" statement, the removal of the __ieee754_ prefix provides consistency across all source files. The last time someone compared lib/msun to fdlibm appears to be commit 3f70824172feb82ea3dcdb3866b54fe0eb7cd890 Author: David Schultz <das@FreeBSD.org> Date: Fri Feb 4 18:26:06 2005 +0000 Reduce diffs against vendor source (Sun fdlibm 5.3). The most recent fdlibm RCS string that appears in a Sun Microsystem copyrighted file is date "95/01/18". With Oracle Corporation's acquisition of Sun Microsystems in 2009, it is unlikely that fdlibm will ever be updated. A search for fdlibm at https://opensource.oracle.com/ yields no hits. Finally, OpenBSD removed the use of this prefix over 21 years ago. pSee revision 1.6 of OpenBSD's math_private.h. Note: this does not drop the __ieee754_ prefix from the trigonometric argument reduction functions, e.g., __ieee754_rem_pio2. These functions are internal to the libm and exported through Symbol.map; and thus, reserved for the implementation. PR: 272783 MFC after: 1 week