History log of /freebsd/lib/msun/Makefile (Results 1 – 25 of 332)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# b45fd24a 07-Sep-2026 Konstantin Belousov <kib@FreeBSD.org>

lib/msun: move the calculation of LIBC_SRCTOP earlier

which makes the variable available for machine/Makefile.inc usage.

Reviewed by: fuz, kfv
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

lib/msun: move the calculation of LIBC_SRCTOP earlier

which makes the variable available for machine/Makefile.inc usage.

Reviewed by: fuz, kfv
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D59462

show more ...


Revision tags: release/14.5.0
# d8b6461f 03-Sep-2026 Faraz Vahedi <kfv@FreeBSD.org>

libm: Implement femode_t, fegetmode(), and fesetmode() as per C23

Reviewed by: kargl, kib
Approved by: fuz (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D59288


Revision tags: release/15.1.0-p3, release/15.0.0-p13, release/14.4.0-p9
# ae417b31 29-Jul-2026 Steve Kargl <kargl@FreeBSD.org>

msun: add asinpi, acospi, and atanpi

This commit implements the inverse half-cycle
trigonometric functions:

asinpi(x) = asin(x) / pi Eq. (1)
acospi(x) = acos(x) / pi

msun: add asinpi, acospi, and atanpi

This commit implements the inverse half-cycle
trigonometric functions:

asinpi(x) = asin(x) / pi Eq. (1)
acospi(x) = acos(x) / pi
atanpi(x) = atan(x) / pi

Implemention details are contained in src/s_asinpi.c and
src/a_atanpi.c, where the details for acospi(x) appear in
the former.

*************

CAVEAT EMPTOR: The ld128 code has been only compiled. It has
not been tested for correctness due to lack of hardware.

*************

Code compiled on AMD Ryzen 7 7700X system run FreeBSD 16.0-CURRENT
main-n284956-de9fe28ab847.

Exhaustive testing of acospif(x), asinpif(x), and atanpif(x)
on the indicated intervals yields

% ./tlibm acospi -fPE -x 0x1p-120 -X 1
Interval tested for acospif: [7.52316e-37,1]
ulp <= 0.5: 99.627% 1002878299 | 99.627% 1002878299
0.5 < ulp <= 0.6: 0.277% 2789599 | 99.904% 1005667898
0.6 < ulp <= 0.7: 0.096% 965062 | 100.000% 1006632960
Max ulp: 0.63661975 at 5.96046412e-08 0x1.fffffep-25

% ./tlibm asinpi -fPED -x 0x1p-120f -X 1.f
Interval tested for asinpif: [7.52316e-37,1]
ulp <= 0.5: 99.851% 1005129353 | 99.851% 1005129353
0.5 < ulp <= 0.6: 0.149% 1501097 | 100.000% 1006630450
0.6 < ulp <= 0.7: 0.000% 2510 | 100.000% 1006632960
Max ulp: 0.68957579 at 5.04878759e-01 0x1.027f78p-1

% ./tlibm atanpi -fPE -x 0x1p-120 -X max > zatanpif.txt &
Interval tested for atanpif: [7.52316e-37,3.40282e+38]
ulp <= 0.5: 99.865% 2077574602 | 99.865% 2077574602
0.5 < ulp <= 0.6: 0.131% 2735011 | 99.997% 2080309613
0.6 < ulp <= 0.7: 0.003% 65170 | 100.000% 2080374783
Max ulp: 0.68433094 at 5.01186252e-01 0x1.009b7cp-1

Testing the double and long double version cannot be done
in an exhaustive manner. For 300 M values, uniformily
distributed in the indicated interals, one finds the max ULP:

Interval tested for acospi: [9.31323e-10,0.25]
xm = 2.4423788416892520e-01, /* 0x3fcf432f, 0xde79920f */
libm = 4.2146222480005391e-01, /* 0x3fdaf93c, 0xb201001c */
mpfr = 4.2146222480005396e-01, /* 0x3fdaf93c, 0xb201001d */
ULP = 0.50499351466286857

Interval tested for acospi: [0.25,0.5]
xm = 4.9689430915631438e-01, /* 0x3fdfcd1d, 0xc9d945c6 */
libm = 3.3447366122373884e-01, /* 0x3fd56804, 0x371513ef */
mpfr = 3.3447366122373889e-01, /* 0x3fd56804, 0x371513f0 */
ULP = 0.57195275455053829

Interval tested for acospi: [0.5,0.75]
xm = 5.0238623667462079e-01, /* 0x3fe0138c, 0x4d0f4be0 */
libm = 3.3245556599062825e-01, /* 0x3fd546f3, 0xb5d36303 */
mpfr = 3.3245556599062820e-01, /* 0x3fd546f3, 0xb5d36302 */
ULP = 0.63427929243758807

Interval tested for acospi: [0.75,1]
xm = 7.5853651919512177e-01, /* 0x3fe845ee, 0x60d8789f */
libm = 2.2591472240382732e-01, /* 0x3fcceac6, 0x0c3465ce */
mpfr = 2.2591472240382729e-01, /* 0x3fcceac6, 0x0c3465cd */
ULP = 0.56915750216472161

Interval tested for asinpi: [9.31323e-10,0.25]
xm = 1.9502362835488171e-01, /* 0x3fc8f688, 0xc4dda0fb */
libm = 6.2478354989018887e-02, /* 0x3faffd29, 0xb6c57c61 */
mpfr = 6.2478354989018881e-02, /* 0x3faffd29, 0xb6c57c60 */
ULP = 0.52347765415885006

Interval tested for asinpi: [0.25,0.5]
xm = 4.9937103583123676e-01, /* 0x3fdff5b1, 0xeeddbf62 */
libm = 1.6643553767987129e-01, /* 0x3fc54dc2, 0x7b9d15a4 */
mpfr = 1.6643553767987126e-01, /* 0x3fc54dc2, 0x7b9d15a3 */
ULP = 0.66214688371031072

Interval tested for asinpi: [0.5,0.75]
xm = 5.0228515250761718e-01, /* 0x3fe012b8, 0x4fe92bbb */
libm = 1.6750722213679006e-01, /* 0x3fc570e0, 0x6c75edd5 */
mpfr = 1.6750722213679009e-01, /* 0x3fc570e0, 0x6c75edd6 */
ULP = 0.78223048105528226

Interval tested for asinpi: [0.75,1]
xm = 7.5425933001419776e-01, /* 0x3fe822e4, 0x7663a4aa */
libm = 2.7200385380185182e-01, /* 0x3fd16882, 0xda1dc13b */
mpfr = 2.7200385380185188e-01, /* 0x3fd16882, 0xda1dc13c */
ULP = 0.53747973176773822

Interval tested for atanpi: [9.31323e-10,0.25]
xm = 1.9666113418757322e-01, /* 0x3fc92c31, 0x29dd6d2f */
libm = 6.1810387818117797e-02, /* 0x3fafa59c, 0x7476baa5 */
mpfr = 6.1810387818117804e-02, /* 0x3fafa59c, 0x7476baa6 */
ULP = 0.54674297446584263

Interval tested for atanpi: [0.25,0.5]
xm = 4.1312119637707068e-01, /* 0x3fda7093, 0xe2ee5494 */
libm = 1.2470309560460152e-01, /* 0x3fbfec8a, 0xc554ebec */
mpfr = 1.2470309560460154e-01, /* 0x3fbfec8a, 0xc554ebed */
ULP = 0.73116638175113347

Interval tested for atanpi: [0.5,0.75]
xm = 5.0018949583396499e-01, /* 0x3fe0018d, 0x66cd1b82 */
libm = 1.4763186871058706e-01, /* 0x3fc2e599, 0xdffacb8f */
mpfr = 1.4763186871058709e-01, /* 0x3fc2e599, 0xdffacb90 */
ULP = 0.69192753950764663

Interval tested for atanpi: [0.75,1]
xm = 7.5007880583359599e-01, /* 0x3fe800a5, 0x448f4c03 */
libm = 2.0484881828445453e-01, /* 0x3fca387c, 0x6f93f71f */
mpfr = 2.0484881828445450e-01, /* 0x3fca387c, 0x6f93f71e */
ULP = 0.65765471872064396

Interval tested for atanpi: [1,2]
xm = 1.0103228000344093e+00, /* 0x3ff02a48, 0x3d88d0a2 */
libm = 2.5163447403817019e-01, /* 0x3fd01ac7, 0x7b229108 */
mpfr = 2.5163447403817013e-01, /* 0x3fd01ac7, 0x7b229107 */
ULP = 0.67409519689166042

Interval tested for atanpi: [2,4]
xm = 2.0231383267437946e+00, /* 0x40002f63, 0x25a530a9 */
libm = 3.5387589538123299e-01, /* 0x3fd6a5e7, 0x156053c6 */
mpfr = 3.5387589538123293e-01, /* 0x3fd6a5e7, 0x156053c5 */
ULP = 0.69695587476021503

Interval tested for atanpi: [4,1.79769e+308]
xm = 4.0000000000000000e+00, /* 0x40100000, 0x00000000 */
libm = 4.2202086962263069e-01, /* 0x3fdb0263, 0xd2508e31 */
mpfr = 4.2202086962263069e-01, /* 0x3fdb0263, 0xd2508e31 */
ULP = 0.27709400511686716

PR: 295884
MFC after: 1 month
Reviewed by: fuz

show more ...


Revision tags: release/15.1.0-p2, release/15.0.0-p12, release/14.4.0-p8, release/15.0.0-p11, release/14.3.0-p16, release/14.4.0-p7, release/15.1.0-p1
# c9991e01 25-Jun-2026 Piotr Kubaj <pkubaj@FreeBSD.org>

powerpc64le: switch from calling wrappers to weak references

Fixes: 255538cd906045095d0c2113ae6c4731ce36c0cf
Differential Revision: https://reviews.freebsd.org/D57850
Reviewed by: adrian


Revision tags: release/15.1.0, release/15.0.0-p10, release/14.4.0-p6, release/14.3.0-p15
# fa3f69fa 04-Jun-2026 Steve Kargl <kargl@FreeBSD.org>

libmsun: Fix incorrect MLINK for sincosl(3)

PR: 295704
MFC after: 1 week


Revision tags: release/14.4.0-p5, release/14.3.0-p14, release/15.0.0-p9
# 3085fc9d 08-May-2026 Steve Kargl <kargl@FreeBSD.org>

[libm] implementation of rsqrt, rsqrtf, and rsqrtl

From the PR:
The attached diff implements the inverse square root function, i.e,
rsqrt(x) = 1 / sqrt(x). Exhaustive testing of the float version
s

[libm] implementation of rsqrt, rsqrtf, and rsqrtl

From the PR:
The attached diff implements the inverse square root function, i.e,
rsqrt(x) = 1 / sqrt(x). Exhaustive testing of the float version
suggests that it is correctly rounded in round-to-nearest for all
test values in the range [0x1p-127,0x1p126].
Exhaustive testing of rsqrt and rsqrtl cannot be done, but 1100M
values of x for rsqrt and 400M values for rsqrtl were tested. All
tested values were correctly rounded.

I do not have access to LD128 (i.e., IEEE 128-bit floating point)
hardware, so the implementation of rsqrtl() is untested.

The following is a summary of changes to source code.

* lib/msun/Makefile:
. Add s_rsqrt.c and s_rsqrtf.c to COMMON_SRCS.
. For non-53-bit long double targets, add s_rsqrtl.c to COMMON_SRCS.
. Add MLINKS for rsqrt.3, rsqrtf.3, and rsqrtl.3 to sqrt.3.

* lib/msun/Symbol.map:
. Add rsqrt, rsqrtf, and rsqrtl to the Symbol map for shared libm.so.

* lib/msun/man/sqrt.3:
. Update the sqrt.3 manual page to include information for rsqrt[fl].
. Note, these function come from ISO C23 (and IEEE-754 2008).

* lib/msun/src/math.h:
. Add prototypes for new functions.

* lib/msun/src/math_private.h:
. Add _SPLIT, _FAST2SUM, _SLOW2SUM, _XADD, _MUL, and _XMUL
macros to perform type-type arthimetic (i.e., float-float).

* src/s_rsqrt.c:
. New file with the implementation of 'double rsqrt(double)'.
. For 53-bit long double targets, add a weak reference for rsqrtl.

* src/s_rsqrtf.c:
. New file with the implementation of 'float rsqrt(float)'.

* src/s_rsqrtl.c
. New file with the implementation of 'long double rsqrt(long double)'.
Note, the LD80 version uses bit twiddling and LD128 version is a
straight C language implementation. The LD128 is untested due to
lack of hardware.

PR: 295089
MFC after: 1 week

show more ...


Revision tags: release/14.4.0-p4, release/14.3.0-p13, release/13.5.0-p14, release/15.0.0-p8, release/14.4.0-p3, release/14.3.0-p12, release/13.5.0-p13, release/15.0.0-p7
# f62d826a 21-Apr-2026 Jesús Blázquez <jesuscblazquez@gmail.com>

lib/msun: fmaximum_mag_num family. Tests and man page

Added the fmaximum_mag_num{,f,l} and fminimum_mag_num{,f,l} functions.

PR: 294719
Reviewed by: fuz, kargl
MFC after: 1 month


Revision tags: release/13.5.0-p12, release/14.3.0-p11, release/14.4.0-p2, release/15.0.0-p6
# 4e30c129 11-Apr-2026 Jesús Blázquez <jesuscblazquez@gmail.com>

lib/msun: Added fmaximum_mag and fmaximum_num families

Added support for the f{maximum,minimum}_{mag,num} families, the new
C23 standard functions for maximum magnitude and number-preferring
maximum

lib/msun: Added fmaximum_mag and fmaximum_num families

Added support for the f{maximum,minimum}_{mag,num} families, the new
C23 standard functions for maximum magnitude and number-preferring
maximum. This includes modifying fmax.3, on top of D56230, to
recommend the use of fmaximum_num and fminimum_num.

Reviewed by: fuz, kargl
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D56236

show more ...


# c913dce8 06-Apr-2026 Konstantin Belousov <kib@FreeBSD.org>

lib/msun: centralize addition of the arch-specific symbol map files

This also adds the aarch64 symbols, exporting them.

Reported and tested by: fluffy
Reviewed by: emaste
Fixes: 3a01e1e1a50cb9a9594

lib/msun: centralize addition of the arch-specific symbol map files

This also adds the aarch64 symbols, exporting them.

Reported and tested by: fluffy
Reviewed by: emaste
Fixes: 3a01e1e1a50cb9a9594aac2148dc920a6b295428
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D56283

show more ...


# e55db843 31-Mar-2026 Jesús Blázquez <jesuscblazquez@gmail.com>

lib/msun: Added fmaximum and fminimum family. Tests and man page

Starting from the existing fmax{,f,l} functions I've added the fmaximum
family, which handles NaN according to the newest standard (p

lib/msun: Added fmaximum and fminimum family. Tests and man page

Starting from the existing fmax{,f,l} functions I've added the fmaximum
family, which handles NaN according to the newest standard (propagating
it).

This commit is a PoC for GSoC 2026.

Reviewed by: fuz, kargl
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D55834

show more ...


Revision tags: release/13.5.0-p11, release/14.3.0-p10, release/14.4.0-p1, release/15.0.0-p5, release/14.4.0, release/13.5.0-p10, release/14.3.0-p9, release/15.0.0-p4, release/15.0.0-p3, release/13.5.0-p9, release/15.0.0-p2, release/14.3.0-p8, release/15.0.0-p1, release/13.5.0-p8, release/14.3.0-p7, release/15.0.0, release/14.3.0-p6, release/13.5.0-p7, release/13.5.0-p6, release/14.3.0-p5, release/13.5.0-p5, release/14.2.0-p7, release/14.3.0-p4, release/14.3.0-p3, release/14.2.0-p6, release/13.5.0-p4, release/13.5.0-p3, release/14.2.0-p5, release/14.3.0-p2, release/14.3.0-p1, release/14.2.0-p4, release/13.5.0-p2, release/14.3.0, release/13.4.0-p5, release/13.5.0-p1, release/14.2.0-p3, release/13.5.0, release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4, release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0, release/13.4.0, release/14.1.0, release/13.3.0
# e38f2308 01-Mar-2024 Mark Murray <markm@FreeBSD.org>

lib/msun: Fix tgammal(3) on IEEE 128-bit platforms

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-op

lib/msun: Fix tgammal(3) on IEEE 128-bit platforms

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

show more ...


# d04e03c1 27-Jan-2024 Dimitry Andric <dim@FreeBSD.org>

msun: remove fabs from Symbol.map, and adjust comment

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 u

msun: remove fabs from Symbol.map, and adjust comment

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

show more ...


# dc36d6f9 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

lib: Remove ancient SCCS tags.

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 s

lib: Remove ancient SCCS tags.

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

show more ...


Revision tags: release/14.0.0
# b19d8afe 05-Sep-2023 Warner Losh <imp@FreeBSD.org>

msun: LIBCSRCDIR is too fragile, use ${SRCTOP}/lib/libc instead

LIBCSRCDIR is defined in bsd.libnames.mk, which is read in later in the
Makefile than the line:

.if exists(${LIBCSRCDIR}/${MACHINE_AR

msun: LIBCSRCDIR is too fragile, use ${SRCTOP}/lib/libc instead

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

show more ...


# d0b2dbfa 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line sh pattern

Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/


Revision tags: release/13.2.0, release/12.4.0
# c44ca4c2 09-Sep-2022 Gleb Popov <arrowd@FreeBSD.org>

msun/Makefile: Fix conditional and unbreak the build.
Approved by: imp
Fixes: 20adba8bc1beb125d5e5ed8f12e747ae79ca6a10


# 20adba8b 08-Aug-2022 Gleb Popov <arrowd@FreeBSD.org>

src.conf: Introduce WITHOUT_MACHDEP knob.

Summary:
This knob can be used to make buildsystem prefer generic C implentations of
various functions, instead of machine-specific assembler ones.

Test Pl

src.conf: Introduce WITHOUT_MACHDEP knob.

Summary:
This knob can be used to make buildsystem prefer generic C implentations of
various functions, instead of machine-specific assembler ones.

Test Plan: `make buildworld` on amd64

Reviewed by: imp, emaste

Differential Revision: https://reviews.freebsd.org/D36076

MFC after: 3 days

show more ...


Revision tags: release/13.1.0
# 03a88e3d 14-Dec-2021 Mark Murray <markm@FreeBSD.org>

* lib/msun/Makefile b/lib/msun/Makefile:
. Disconnect imprecise.c from the build. This file can be deleted.
. Add b_tgammal.c to the build for ld80 and ld128 targets. The ld128
is a 'git mv

* lib/msun/Makefile b/lib/msun/Makefile:
. Disconnect imprecise.c from the build. This file can be deleted.
. Add b_tgammal.c to the build for ld80 and ld128 targets. The ld128
is a 'git mv' of imprecise.c to ld128/b_tgammal.c.

* lib/msun/ld80/b_expl.c:
. New file. Implement __exp__D for ld80 targets. This is based on
bsdsrc/b_exp.c.

* lib/msun/ld80/b_logl.c:
. New file. Implement __log__D for ld80 targets. This is based on
bsdsrc/b_log.c.

* lib/msun/ld80/b_tgammal.c b/lib/msun/ld80/b_tgammal.c
. New file. Implement tgammal(x) for ld80 targets.

Submitted by: Steve Kargl
Differential Revision: https://reviews.freebsd.org/D33444
Reviewed by: pfg

show more ...


# 455b2ccd 14-Dec-2021 Mark Murray <markm@FreeBSD.org>

* lib/msun/Makefile:
. Disconnect b_exp.c and b_log.c from the build.

* lib/msun/bsdsrc/b_exp.c:
. Replace scalb() usage with C99's ldexp().
. Replace finite(x) usage with C99's isfinite().

* lib/msun/Makefile:
. Disconnect b_exp.c and b_log.c from the build.

* lib/msun/bsdsrc/b_exp.c:
. Replace scalb() usage with C99's ldexp().
. Replace finite(x) usage with C99's isfinite().
. Whitespace changes towards style(9).
. Remove include of "mathimpl.h". It is no longer needed.
. Remove #if 0 ... #endif code, which has been present since svn r93211
(2002-03-26).
. New minimax polynomial coefficients.
. Add comments to explain origins of some constants.
. Use ansi-C prototype. Remove K&R prototype. Add static to prototype.

* lib/msun/bsdsrc/b_log.c:
. Remove include of "mathimpl.h". It is no longer needed.
. Fix comments to actually describe the code.
. Reduce minimax polynomial from degree 4 to degree 3.
This uses newly computed coefficients.
. Use ansi-C prototype. Remove K&R prototype. Add static to prototype.
. Remove volatile in declaration of u1.
. Alphabetize decalaration list.
. Whitespace changes towards style(9).
. In argument reduction of x to g and m, replace use of logb() and
ldexp() with a single call to frexp(). Add code to get 1 <= g < 2.
. Remove #if 0 ... #endif code, which has been present since svn r93211
(2002-03-26).
. The special case m == -1022, replace logb() with ilogb().

* lib/msun/bsdsrc/b_tgamma.c:
. Update comments. Fix comments where needed.
. Add float.h to get LDBL_MANT_DIG for weak reference of tgammal to tgamma.
. Remove include of "mathimpl.h". It is no longer needed.
. Use "math.h" instead of <math.h>.
. Add '#include math_private.h"
. Add struct Double from mathimpl.h and include b_log.c and b_exp.c.
. Remove forward declarations of neg_gam(), small_gam(), smaller_gam,
large_gam() and ratfun_gam() by re-arranging the code to move these
function above their first reference.
. New minimax coefficients for polynomial in large_gam().
. New splitting of a0 into a0hi nd a0lo, which include additional
bits of precision.
. Use ansi-C prototype. Remove K&R prototype.
. Replace the TRUNC() macro with a simple cast of a double entities
to float before assignment (functional changes).
. Replace sin(M_PI*z) with sinpi(z) and cos(M_PI*(0.5-z)) with cospi(0.5-z).

Submitted by: Steve Kargl
Differential Revision: https://reviews.freebsd.org/D33444
Reviewed by: pfg

show more ...


Revision tags: release/12.3.0
# b2e84316 02-Nov-2021 Andrew Turner <andrew@FreeBSD.org>

Use a builtin where possible in msun

Some of the functions in msun can be implemented using a compiler
builtin function to generate a small number of instructions. Implement
this support in fma, fma

Use a builtin where possible in msun

Some of the functions in msun can be implemented using a compiler
builtin function to generate a small number of instructions. Implement
this support in fma, fmax, fmin, and sqrt on arm64.

Care must be taken as the builtin can be implemented as a function
call on some architectures that lack direct support. In these cases
we need to use the original code path.

As we don't set errno on failure build with -fno-math-errno so the
toolchain doesn't convert a builtin into a function call when it
detects a failure, e.g. gcc will add a call to sqrt when the input
is negative leading to an infinite loop.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32801

show more ...


# 046e2d5d 05-Nov-2021 Steve Kargl <kargl@FreeBSD.org>

Implementations of cexpl()

The change implements cexpl() for both ld80 and ld128 architectures.
Testing was done on x86_64 and aarch64 systems.

Along the way sincos[fl]() use an optimization that r

Implementations of cexpl()

The change implements cexpl() for both ld80 and ld128 architectures.
Testing was done on x86_64 and aarch64 systems.

Along the way sincos[fl]() use an optimization that reduces the argument
to being done one rather than twice. This optimization actually pointed
to a bug in the ld128 version of sincosl(), which is now fixed. In
addition, the minmax polynomial coefficients for sincosl() have been
updated.

A concise log of the file-by-file changes follows.

* include/complex.h:
. Add a prototype for cexpl().

* lib/msun/Makefile:
. Add s_cexpl.c to the build.
. Setup a link for cexpl.3 to cexp.3.

* lib/msun/Symbol.map:
. Expose cexpl symbol in libm shared library.

* lib/msun/ld128/s_cexpl.c:
* Implementation of cexpl() for 128-bit long double architectures.
Tested on an aarch64 system.

* lib/msun/ld80/s_cexpl.c:
* Implementation of cexpl() for Intel 80-bit long double.

* lib/msun/man/cexp.3:
. Document cexpl().

* lib/msun/man/complex.3:
. Add a BUGS section about cpow[fl].

* lib/msun/src/s_cexp.c:
. Include float.h for weak references on 53-bit long double targets.
. Use sincos() to reduce argument reduction cost.

* lib/msun/src/s_cexpf.c:
. Use sincosf() to reduce argument reduction cost.

* lib/msun/src/k_sincosl.h:
. Catch up with the new minmax polynomial coefficients for the kernel for
the 128-bit cosl() implementation.
. BUG FIX: *cs was used where *sn should have been. This means that sinl()
was no computed correctly when iy != 0.

* lib/msun/src/s_cosl.c:
. Include fpmath.h to get access to IEEEl2bits.
. Replace M_PI_4 with pio4, a 64-bit or 113-bit approximation for pi / 4.

PR: 216862
MFC after: 1 week

show more ...


# ca3d8cb0 26-Oct-2021 Steve Kargl <kargl@FreeBSD.org>

lib/msun: Move the files to appropriate locations in the Makefile

Fixes: dce5f3abed7181cc533ca5ed
PR: 218514
MFC after: 1 week


# dce5f3ab 25-Oct-2021 Steve Kargl <kargl@FreeBSD.org>

[LIBM] implementations of sinpi[fl], cospi[fl], and tanpi[fl]

Both IEEE-754 2008 and ISO/IEC TS 18661-4 define the half-cycle
trignometric functions cospi, sinpi, and tanpi. The attached
patch impl

[LIBM] implementations of sinpi[fl], cospi[fl], and tanpi[fl]

Both IEEE-754 2008 and ISO/IEC TS 18661-4 define the half-cycle
trignometric functions cospi, sinpi, and tanpi. The attached
patch implements cospi[fl], sinpi[fl], and tanpi[fl]. Limited
testing on the cospi and sinpi reveal a max ULP less than 0.89;
while tanpi is more problematic with a max ULP less than 2.01
in the interval [0,0.5]. The algorithms used in these functions
are documented in {ks}_cospi.c, {ks}_sinpi.c, and s_tanpi.c.

Note. I no longer have access to a system with ld128 and
adequate support to compile and test the ld128 implementations
of these functions. Given the almost complete lack of input from
others on improvements to libm, I doubt that anyone cares. If
someone does care, the ld128 files contain a number of FIXME comments,
and in particular, while the polynomial coefficients are given
I did not update the polynomial algorithms to properly use the
coefficients.

PR: 218514
MFC after: 2 weeks

show more ...


# 168234fa 15-Apr-2021 Alex Richardson <arichardson@FreeBSD.org>

lib/msun: Exclude ignored-pragmas from -Werror

This avoids build failures due to the clang 12 warning:
'#pragma FENV_ACCESS' is not supported on this target - ignored

Clang 12 currently emits t

lib/msun: Exclude ignored-pragmas from -Werror

This avoids build failures due to the clang 12 warning:
'#pragma FENV_ACCESS' is not supported on this target - ignored

Clang 12 currently emits this warning for all non-x86 architectures.
While this can result in incorrect code generation (e.g. on AArch64 some
exceptions are not raised as expected), this is a pre-existing issue and
we should not fail the build due to this warning.

Reviewed By: dim, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29743

show more ...


# bae9fd0b 10-Apr-2021 Dimitry Andric <dim@FreeBSD.org>

Only use -fp-exception-behavior=maytrap on x86, for now

After 3b00222f156d, it turns out that clang only supports strict
floating point semantics for SystemZ and x86 at the moment, while for
other a

Only use -fp-exception-behavior=maytrap on x86, for now

After 3b00222f156d, it turns out that clang only supports strict
floating point semantics for SystemZ and x86 at the moment, while for
other architectures it is still experimental.

Therefore, only use -fp-exception-behavior=maytrap on x86 for now,
otherwise this option results in "error: overriding currently
unsupported use of floating point exceptions on this target
[-Werror,-Wunsupported-floating-point-opt]" on other architectures.

Fixes: 3b00222f156d
PR: 254911
MFC after: 1 week

show more ...


12345678910>>...14