History log of /freebsd-11-stable/lib/msun/Makefile
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 369609 15-Apr-2021 dim

Avoid raising unexpected floating point exceptions in libm

When using clang with x86_64 CPUs that support AVX, some floating point
transformations may raise exceptions that would not have been raised by
the original code. To avoid this, use the -fp-exception-behavior=maytrap
flag, introduced in clang 10.0.0.

In particular, this fixes a number of test failures with ctanhf(3) and
ctanf(3), when libm is compiled with -mavx. An unexpected FE_INVALID
exception is then raised, because clang emits vdivps instructions to
perform certain divides. (The vdivps instruction operates on multiple
single-precision float operands simultaneously, but the exceptions may
be influenced by unused parts of the XMM registers. In this particular
case, it was calculating 0 / 0, which results in FE_INVALID.)

If -fp-exception-behavior=maytrap is specified however, clang uses
vdivss instructions instead, which work on one operand, and should not
raise unexpected exceptions.

Reported by: olivier
Reviewed by: arichardson
PR: 254911
Differential Revision: https://reviews.freebsd.org/D29686

(cherry picked from commit 3b00222f156dca5700c839d73e36daf479fa640c)

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

(cherry picked from commit bae9fd0b33462e9506c3ac3400089c6dbc4aee8f)

Git Hash: cabc474b2dc9c6741b240e454da86a7ff2ff9f9c
Git Author: dim@FreeBSD.org


# 369608 15-Apr-2021 dim

libm: squelch -Woverflow from gcc6

Sponsored by: Dell EMC Isilon

(cherry picked from commit 50b06886a715d7be052e1742f7d11ce82928f134)

Git Hash: e7cc5cda88f079b80636aa7f71b0fc671701f77d
Git Author: vangyzen@FreeBSD.org


# 336767 27-Jul-2018 dim

MFC r327400 (by eadler):

cacos(3): correct spelling of 'I'

In some cases we had 'i' instead of 'I'.

PR: 195517
Submitted by: stephen

MFC r329259 (by eadler):

msun: signed overflow in atan2

As a component of atan2(y, x), the case of x == 1.0 is farmed out to
atan(y). The current implementation of this comparison is vulnerable
to signed integer underflow (that is, undefined behavior), and it's
performed in a somewhat more complicated way than it need be. Change
it to not be quite so cute, rather directly comparing the high/low
bits of x to the specific IEEE-754 bit pattern that encodes 1.0.

Note that while there are three different e_atan* files in the
relevant directory, only this one needs fixing. e_atan2f.c already
compares against the full bit pattern encoding 1.0f, while
e_atan2l.cuses bitwise-ands/ors/nots and so doesn't require a change.

Closes #130

Submitted by: Jeff Walden (@jswalden github PR #130)
Reviewed by: bde

MFC r334721 (by cem):

clog.3, complex.3: Fix typos and igor style issues

PR: 228783
Reported by: Karsten <freebsd-bugzilla AT kkoenig.net>

MFC r336299 (by mmacy):

msun: add ld80/ld128 powl, cpow, cpowf, cpowl from openbsd

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

MFC r336563:

Recommit r336497: Fix powl, cpow, cpowf, and cpowl imports from OpenBSD

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


# 334654 05-Jun-2018 kib

MFC r333577:
Add implementations for clog(3), clogf(3), and clogl(3).

PR: 216863


# 324006 26-Sep-2017 dim

Synchronize most of libm with head as of r323004. This excludes a few
arch-specific updates for powerpcspe, mips and riscv, for which support
has not been merged yet.

Bump __FreeBSD_version for the addition of cacoshl, cacosl, casinhl,
casinl, catanl, catanhl, sincos, sincosf, and sincosl.

MFC r305382 (by bde):

Add asm versions of fmod(), fmodf() and fmodl() on amd64. Add asm
versions of fmodf() amd fmodl() on i387.

fmod is similar to remainder, and the C versions are 3 to 9 times
slower than the asm versions on x86 for both, but we had the strange
mixture of all 6 variants of remainder in asm and only 1 of 6
variants of fmod in asm.

MFC r305384 (by bde):

Disconnect the "optimized" asm variants of cos(), sin() and tan() from
the build on i386. Leave them in the source tree for regression tests.

The asm functions were always much less accurate (by a factor of more
than 10**18 in the worst case). They were faster on old CPUs. But
with each new generation of CPUs they get relatively slower. The
double precision C version's average advantage is about a factor of 2
on Haswell.

The asm functions were already intentionally avoided in float and long
double precision on i386 and in all precisions on amd64. Float
precision and amd64 give larger advantages to the C version. The long
double precision C code and compilers' understanding of long double
precision are not so good, so the i387 is still slightly faster for
long double precision, except for the unimportant subcase of huge args
where the sub-optimal C code now somehow beats the i387 by about a
factor of 2.

MFC r305385 (by bde):

Oops, the previous i386 version of e_fmodf.S and e_fmodl.S was
actually the amd64 version.

MFC r306409 (by emaste):

libm: fix some unused variable (rcsid) and dangling else warnings

s_{fabs,fmax,logb,scalb}{,f,l}.c may be built elsewhere with a higher
WARNS setting.

Reviewed by: ed
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8061

MFC r306410 (by emaste):

libm: simplify i387 subdir logic with make's :S substitution

MFC r306527 (by emaste):

libm: remove unused variables for LDBL_MANT_DIG != 113

Sponsored by: The FreeBSD Foundation

MFC r306709 (by emaste):

libm: remove unused variables

Sponsored by: The FreeBSD Foundation

MFC r307066 (by br):

Don't use fmaxl/fminl on platforms with no long double support,
use fmax/fmin instead.

This fixes fmaxmin test failure on MIPS64.

Reviewed by: emaste
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5
Differential Revision: https://reviews.freebsd.org/D8216

MFC r308172 (by emaste):

libm: add braces around initialization of subobjects

This cleans up a warning when building libm at higher WARNS levels and
makes the intent more clear. By the C standard the values are assigned
to subobject members in order so this change introduces no functional
change. (6.7.9 20)

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8333

MFC r313761 (by mmokhi):

Add casinl() cacosl() catanl() casinhl() cacoshl() catanhl() APIs to msun
to improve C11 conformance.

PR: 216850 216851 216852 216856 216857 216858
Submitted by: mmokhi
Reported by: sgk@troutmask.apl.washington.edu
Reviewed by: bde, mat, theraven
Approved by: bde (src committer), mat (mentor)
Differential Revision: https://reviews.freebsd.org/D9491

MFC r313863 (by mmokhi):

Fix building of r313761 on platforms that
`long double` is alias of `double` (MIPS, etc)

PR: 216850 216851 216852 216856 216857 216858
Reported by: emsate
Reviewed by: bde emaste hselasky
Approved by: bde emaste hselasky
Differential Revision: https://reviews.freebsd.org/D9491

MFC r313864 (by mmokhi):

Add documentations related to new APIs of r313761

PR: 216850 216851 216852 216856 216857 216858
Submitted by: sgk@troutmask.apl.washington.edu
Reported by: sgk@troutmask.apl.washington.edu
Reviewed by: bde emaste hselasky
Approved by: bde emaste hselasky
Differential Revision: https://reviews.freebsd.org/D9491

MFC r314950 (by ngie):

Don't expect :test_large_inputs to fail with i386 anymore

Recent changes (maybe a side-effect of the ATF-ification in r314649)
invalidate the failure expectation.

PR: 205446
Sponsored by: Dell EMC Isilon

MFC r317349 (by pfg):

msun: Remove trailing space in Sunsoft copyright statement.

Submittedby: kargl

MFC r319047 (by mmel):

Implement sincos, sincosf, and sincosl.
The primary benefit of these functions is that argument
reduction is done once instead of twice in independent
calls to sin() and cos().

* lib/msun/Makefile:
. Add s_sincos[fl].c to the build.
. Add sincos.3 documentation.
. Add appropriate MLINKS.

* lib/msun/Symbol.map:
. Expose sincos[fl] symbols in dynamic libm.so.

* lib/msun/man/sincos.3:
. Documentation for sincos[fl].

* lib/msun/src/k_sincos.h:
. Kernel for sincos() function. This merges the individual kernels
for sin() and cos(). The merger offered an opportunity to re-arrange
the individual kernels for better performance.

* lib/msun/src/k_sincosf.h:
. Kernel for sincosf() function. This merges the individual kernels
for sinf() and cosf(). The merger offered an opportunity to re-arrange
the individual kernels for better performance.

* lib/msun/src/k_sincosl.h:
. Kernel for sincosl() function. This merges the individual kernels
for sinl() and cosl(). The merger offered an opportunity to re-arrange
the individual kernels for better performance.

* lib/msun/src/math.h:
. Add prototytpes for sincos[fl]().

* lib/msun/src/math_private.h:
. Add RETURNV macros. This is needed to reset fpsetprec on I386
hardware for a function with type void.

* lib/msun/src/s_sincos.c:
. Implementation of sincos() where sin() and cos() were merged into
one routine and possibly re-arranged for better performance.

* lib/msun/src/s_sincosf.c:
. Implementation of sincosf() where sinf() and cosf() were merged into
one routine and possibly re-arranged for better performance.

* lib/msun/src/s_sincosl.c:
. Implementation of sincosl() where sinl() and cosl() were merged into
one routine and possibly re-arranged for better performance.

PR: 215977, 218300
Submitted by: Steven G. Kargl <sgk@troutmask.apl.washington.edu>
Differential Revision: https://reviews.freebsd.org/D10765

MFC r321457 (by ngie):

Mark :reduction as an expected failure

It fails with clang 5.0+.

PR: 220989
Reported by: Jenkins

MFC r322418 (by rlibby):

lib/msun: avoid referring to broken LDBL_MAX

LDBL_MAX is broken on i386:
https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September/000288.html

Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32
for some time, and newer versions of gcc are now warning that the
"floating constant exceeds range of 'long double'". Avoid this by
referring to half the value of LDBL_MAX instead.

Reviewed by: bde
Approved by: markj (mentor)
Sponsored by: Dell EMC Isilon

MFC r322435 (by rlibby):

Revert r322418, LDBL_MAX_EXP unsuitable for macro pasting on some arches

Either need a different way to spell HALF_LDBL_MAX, or a different way
to spell LDBL_MAX_EXP, or a different approach.

Reported by: ian

MFC r322921 (by ngie):

Revert r321457

It doesn't fail after ^/head@r322855 (the releng_50 clang merge).

PR: 220989


# 302408 07-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
# 298107 16-Apr-2016 gjb

Merge the projects/release-pkg branch to head.

This allows packaging the base system with pkg(8), including
but not limited to providing the ability to provide upstream
binary update possibilities for non-tier-1 architectures.

This merge is a requirement of the 11.0-RELEASE, and as such,
thank you to everyone that has tested the project branch.

Documentation in build(7) etc. is still somewhat sparse, but
updates to those parts will follow.

Sponsored by: The FreeBSD Foundation


# 291620 01-Dec-2015 bdrewery

Don't override LIB*DIR variables from src.libnames.mk.

In some cases switch to the LIB*SRCDIR value.

These recently were defined in r291327 and r291619.

Sponsored by: EMC / Isilon Storage Division


# 290605 09-Nov-2015 ngie

Document powl(3)

PR: 191751
Sponsored by: EMC / Isilon Storage Division


# 284421 15-Jun-2015 bapt

Revert r284417 it is not necessary anymore


# 284417 15-Jun-2015 bapt

Enforce overwritting SHLIBDIR

Since METAMODE has been added, sys.mk loads bsd.mkopt.mk which ends load loading
bsd.own.mk which then defines SHLIBDIR before all the Makefile.inc everywhere.

This makes /lib being populated again.

Reported by: many


# 284289 11-Jun-2015 sjg

Misc fixes from projects/bmake

Differential Revision: D2748
Reviewed by: brooks imp


# 282057 27-Apr-2015 ngie

Build/install libc, librt, libthr, and msun NetBSD test suites on all
architectures

MFC after: 1 week


# 274618 17-Nov-2014 ngie

Add reachover Makefiles for contrib/netbsd-tests/lib/librt

A variant of this code has been tested on amd64/i386 for some time by
EMC/Isilon on 10-STABLE/11-CURRENT. It builds on other architectures, but the
code will remain off until it's proven it works on virtual hardware or real
hardware on other architectures

Sponsored by: EMC / Isilon Storage Division


# 271651 15-Sep-2014 kargl

* Makefile:
. Hook e_lgammal[_r].c to the build.
. Create man page links for lgammal[-r].3.

* Symbol.map:
. Sort lgammal to its rightful place.
. Add FBSD_1.4 section for the new lgamal_r symbol.

* ld128/e_lgammal_r.c:
. 128-bit implementataion of lgammal_r().

* ld80/e_lgammal_r.c:
. Intel 80-bit format implementation of lgammal_r().

* src/e_lgamma.c:
. Expose lgammal as a weak reference to lgamma for platforms
where long double is mapped to double.

* src/e_lgamma_r.c:
. Use integer literal constants instead of real literal constants.
Let compiler(s) do the job of conversion to the appropriate type.
. Expose lgammal_r as a weak reference to lgamma_r for platforms
where long double is mapped to double.

* src/e_lgammaf_r.c:
. Fixed the Cygnus Support conversion of e_lgamma_r.c to float.
This includes the generation of new polynomial and rational
approximations with fewer terms. For each approximation, include
a comment on an estimate of the accuracy over the relevant domain.
. Use integer literal constants instead of real literal constants.
Let compiler(s) do the job of conversion to the appropriate type.
This allows the removal of several explicit casts of double values
to float.

* src/e_lgammal.c:
. Wrapper for lgammal() about lgammal_r().

* src/imprecise.c:
. Remove the lgamma.

* src/math.h:
. Add a prototype for lgammal_r().

* man/lgamma.3:
. Document the new functions.

Reviewed by: bde


# 268593 13-Jul-2014 kargl

* Makefile:
. Add s_erfl.c to building libm.
. Add MLINKS for erfl.3 and erfcl.3.

* Symbol.map:
. Move erfl and erfcl to their proper location.

* ld128/s_erfl.c:
. Implementations of erfl and erfcl in the IEEE 754 128-bit format.

* ld80/s_erfl.c:
. Implementations of erfl and erfcl in the Intel 80-bit format.

* man/erf.3:
. Document the new functions.
. While here, remove an incomplete sentence.

* src/imprecise.c:
. Remove the stupidity of mapping erfl and erfcl to erf and erfc.

* src/math.h:
. Move the declarations of erfl and erfcl to their proper place.

* src/s_erf.c:
. For architectures where double and long double are the same
floating point format, use weak references to map erfl to
erf and ercl to erfc.

Reviewed by: bde (many earlier versions)


# 262613 28-Feb-2014 dim

Merge the projects/clang-sparc64 branch back to head. This brings in
several updates from the llvm and clang trunks to make the sparc64
backend fully functional.

Apart from one patch to sys/sparc64/include/pcpu.h which is still under
discussion, this makes it possible to let clang fully build world and
kernel for sparc64.

Any assistance with testing this on actual sparc64 hardware is greatly
appreciated, as there will unavoidably be bugs left.

Many thanks go to Roman Divacky for his upstream work on getting the
sparc64 backend into shape.

MFC after: 1 month


# 260067 29-Dec-2013 kargl

* Makefile:
. Hook coshl, sinhl, and tanhl into libm.
. Create symbolic links for corresponding manpages.
. While here remove a nearby extraneous space.

* Symbol.map:
* src/math.h:
. Move coshl, sinhl, and tanhl to their proper locations.

* man/cosh.3:
* man/sinh.3:
* man/tanh.3:
. Update the manpages.

* src/e_cosh.c:
* src/e_sinh.c:
* src/s_tanh.c:
. Add weak reference for LBDL_MANT_DIG==53 targets.

* src/imprecise.c:
. Remove the coshl, sinhl, and tanhl kludge.

* src/e_coshl.c:
. ld80 and ld128 implementation of coshl().

* src/e_sinhl.c:
. ld80 and ld128 implementation of sinhl().

* src/s_tanhl.c:
. ld80 and ld128 implementation of tanhl().

Obtained from: bde (mostly), das and kargl


# 257818 07-Nov-2013 kargl

Fix bulding libm on platforms with LDBL_MANT_DIG == 53.

Reported by: ian


# 255294 06-Sep-2013 theraven

Add stub implementations of the missing C++11 math functions.
These are weak and so can be replaced by other versions in applications
that choose to do so, and will give a linker warning when used so that
applications that rely on the extra precision can avoid them.

Note that since the C/C++ specs only guarantee that long double has
precision equal to double, code that actually relies on these functions
having greater precision is unportable at best and broken at worst.


# 251599 10-Jun-2013 das

Add implementations of acoshl(), asinhl(), and atanhl(). This is a
merge of the work done by bde and myself.


# 251404 05-Jun-2013 das

Style fixes.

Submitted by: bde


# 251366 04-Jun-2013 das

Add man links for expl(3) and expm1l(3).


# 251292 03-Jun-2013 das

Add logl, log2l, log10l, and log1pl.

Submitted by: bde


# 251121 30-May-2013 das

I'm happy to finally commit stephen@'s implementations of cacos,
cacosh, casin, casinh, catan, and catanh. Thanks to stephen@ and bde@
for working on these.

Submitted by: stephen@
Reviewed by: bde


# 251024 27-May-2013 das

Fix some regressions caused by the switch from gcc to clang. The fixes
are workarounds for various symptoms of the problem described in clang
bugs 3929, 8100, 8241, 10409, and 12958.

The regression tests did their job: they failed, someone brought it
up on the mailing lists, and then the issue got ignored for 6 months.
Oops. There may still be some regressions for functions we don't have
test coverage for yet.


# 249724 21-Apr-2013 kib

Merge the 386 and amd64 versions of the fenv.h, to make cc -m32
compilations which use fenv.h work.

Reviewed by: tjil
Sponsored by: The FreeBSD Foundation


# 238724 23-Jul-2012 kargl

Hook ld80/s_expl.c or ld128/s_expl.c into the building of libm.

PR: standards/152415
Approved by: das (mentor)


# 230192 16-Jan-2012 das

Add an implementation of fenv.h intended for platforms that lack an FPU and
use softfloat.

Thanks to Ian Lepore for testing and debugging this patch. The fenv
regression tests pass (at least for Ian's arm chip) with this change.


# 226597 21-Oct-2011 das

The cexp() and {,c}{cos,sin}h functions all need to be able to compute
exp(x) scaled down by some factor, and the challenge is doing this
accurately when exp(x) would overflow. This change replaces all of
the tricks we've been using with common __ldexp_exp() and
__ldexp_cexp() routines that handle all the scaling.

bde plans to improve on this further by moving the guts of exp() into
k_exp.c and handling the scaling in a more direct manner. But the
current approach is simple and adequate for now.


# 226458 17-Oct-2011 das

Add c{cos,sin,tan}{,h}{,f} functions. This is joint work with
bde and kargl.


# 219576 12-Mar-2011 kargl

Take two. Add the missing file that should have been committed
with r219571 and re-enable building of cbrtl.

Implement the long double version for the cube root function, cbrtl.
The algorithm uses Newton's iterations with a crude estimate of the
cube root to converge to a result.

Reviewed by: bde
Approved by: das


# 219572 12-Mar-2011 kargl

Temporary disable the building of cbrtl until I
can determine why svn will not allow one to commit
a new file.

Approved by: das (implicit)


# 219571 12-Mar-2011 kargl

Implement the long double version for the cube root function, cbrtl.
The algorithm uses Newton's iterations with a crude estimate of the
cube root to converge to a result.

Reviewed by: bde
Approved by: das


# 219359 07-Mar-2011 das

Add cexp() and cexpf().

Reviewed by: bde (earlier version)


# 218877 20-Feb-2011 murray

Add complex(3) manual page documenting our partial support for C99
complex arithmetic in libm.

Reviewed by: David Schultz <das@FreeBSD.org>
MFC after: 2 weeks


# 216211 05-Dec-2010 das

Add log2() and log2f().


# 216137 02-Dec-2010 das

Disable gcc's built-in rint() function when compiling s_nearbyint.c.
It results in incorrect optimizations that break nearbyint().

PR: 143358
Reviewed by: bde


# 212531 13-Sep-2010 imp

This is exactly the same as the .else, so remove it.


# 212518 12-Sep-2010 imp

MFtbemd: Move to using MACHINE_CPUARCH, now that it is safe.


# 211934 28-Aug-2010 nwhitehorn

Repair some build breakage introduced in r211725 and garbage collect some
code made obsolete in the same commit.


# 211725 23-Aug-2010 imp

MFtbemd:

Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want
to test of all the CPUs of a given family conform.


# 209877 10-Jul-2010 nwhitehorn

powerpc64 floating-point is identical to powerpc, so use the same
code on both architectures.


# 181377 07-Aug-2008 das

Implement cproj{,f,l}().


# 181074 31-Jul-2008 das

Add implementations of acosl(), asinl(), atanl(), atan2l(),
and cargl().

Reviewed by: bde
sparc64 testing resources from: remko


# 181064 31-Jul-2008 das

Set WARNS=1.

I believe I've committed all the bits necessary to make this compile
on all supported architectures. :crosses fingers:


# 180581 18-Jul-2008 das

Sort the .PATH entries to give a more reasonable order of precedence:
1. architecture-specific files
2. long double format-specific files
3. bsdsrc
4. src
5. man
The original order was virtually the opposite of this.

This should not cause any functional changes at this time. The
difference is only significant when one wants to override, say, a
generic foo.c with a more specialized foo.c (as opposed to foo.S).


# 179882 19-Jun-2008 das

Implement fmodl.
Document fmodl and fix some errors in the fmod manpage.


# 177766 30-Mar-2008 das

Hook remquol() and remainderl() up to the build.


# 177761 30-Mar-2008 das

Implement csqrtl().


# 177760 30-Mar-2008 das

Hook hypotl() and cabsl() up to the build.


# 176722 01-Mar-2008 das

Hook up sqrtl() to the build.


# 176388 18-Feb-2008 das

Add tgammaf() as a simple wrapper around tgamma().


# 176361 17-Feb-2008 das

Hook up sinl(), cosl(), and tanl() to the build.


# 176243 13-Feb-2008 bde

On arches where long double is the same as double, alias ceil(), floor()
and trunc() to the corresponding long double functions. This is not
just an optimization for these arches. The full long double functions
have a wrong value for `huge', and the arches without full long doubles
depended on it being wrong.


# 175462 18-Jan-2008 das

Hook up exp2l() and related docs to the build.


# 175309 14-Jan-2008 das

Implement rintl(), nearbyintl(), lrintl(), and llrintl().
Thanks to bde@ for feedback and testing of rintl().


# 174720 17-Dec-2007 bde

Oops, the previous commit was not needed -- the file was committed but
not checked out due to my checkout error.


# 174715 17-Dec-2007 bde

Don't try to build s_nanl.c before it is committed.


# 174698 17-Dec-2007 das

Add logbl(3) to libm.


# 174684 16-Dec-2007 das

Implement and document nan(), nanf(), and nanl(). This commit
adds two new directories in msun: ld80 and ld128. These are for
long double functions specific to the 80-bit long double format
used on x86-derived architectures, and the 128-bit format used on
sparc64, respectively.


# 174617 15-Dec-2007 das

Implement and document csqrt(3) and csqrtf(3).


# 174561 12-Dec-2007 das

Implement carg(3) and cargf(3).

Rotting in an old src tree since: March 2005


# 169807 21-May-2007 deischen

Bump library versions in preparation for 7.0.

Ok'd by: kan


# 169524 13-May-2007 deischen

Enable symbol versioning by default. Use WITHOUT_SYMVER to disable it.
Warning, after symbol versioning is enabled, going back is not easy
(use WITHOUT_SYMVER at your own risk).

Change the default thread library to libthr.

There most likely still needs to be a version bump for at least the
thread libraries. If necessary, this will happen later.


# 165855 07-Jan-2007 das

Implement modfl().


# 157196 27-Mar-2006 deischen

Add symbol versioning to libm.


# 152133 06-Nov-2005 bde

Detach k_rem_pio2f.c from the build since it is now unused. It is a libm
internal so this shouldn't cause version problems.


# 152117 06-Nov-2005 bde

The logb() functions are not just ieee754 "test" functions, but are
standard in C99 and POSIX.1-2001+. They are also not deprecated, since
apart from being standard they can handle special args slightly better
than the ilogb() functions.

Move their documentation to ilogb.3. Try to use consistent and improved
wording for both sets of functions. All of ieee854, C99 and POSIX
have better wording and more details for special args.

Add history for the logb() functions and ilogbl(). Fix history for
ilogb().


# 148297 22-Jul-2005 kensmith

Bump the shared library version number of all libraries that have not
been bumped since RELENG_5.

Reviewed by: ru
Approved by: re (not needed for commit check but in principle...)


# 145208 17-Apr-2005 ache

Fix truncl.3 MLINKS


# 145170 16-Apr-2005 das

Implement truncl() based on floorl().


# 144772 07-Apr-2005 das

Add roundl(), lroundl(), and llroundl().


# 144650 05-Apr-2005 das

Build exp2(), exp2f(), and related documentation.


# 144091 25-Mar-2005 das

Implement and document remquo() and remquof().


# 143709 16-Mar-2005 das

Document feenableexcept(), fedisableexcept(), and fegetexcept().


# 143222 07-Mar-2005 das

- Remove s_ldexpf.c (now aliased to scalbn.)
- Add nexttoward{,f,l} and nextafterl. On all platforms,
nexttowardl is an alias for nextafterl.
- Add fmal.
- Add man pages for new routines: fmal, nextafterl,
nexttoward{,f,l}, scalb{,l}nl.

Note that on platforms where long double is the same as double, we
generally just alias the double versions of the routines, since doing
so avoids extra work on the source code level and redundant code in
the binary. In particular:

ldbl53 ldbl64/113
fmal s_fma.c s_fmal.c
ldexpl s_scalbn.c s_scalbnl.c
nextafterl s_nextafter.c s_nextafterl.c
nexttoward s_nextafter.c s_nexttoward.c
nexttowardf s_nexttowardf.c s_nexttowardf.c
nexttowardl s_nextafter.c s_nextafterl.c
scalbnl s_scalbn.c s_scalbnl.c


# 142558 26-Feb-2005 das

Un-document the non-extant exp10() and exp10f() functions.
exp10() was a casualty of the transition away from the VAX.


# 141297 04-Feb-2005 das

Remove another vestige of support for a non-IEEE libm.


# 141281 04-Feb-2005 das

Move machine-dependent crud to its own makefile.


# 141280 04-Feb-2005 das

Remove wrappers and other cruft intended to support SVID, mistakes in
C90, and other arcana. Most of these features were never fully
supported or enabled by default.

Ok: bde, stefanf


# 140890 27-Jan-2005 das

- Move the functions presently described in in ieee(3) to their own
manpages. They are not very related, so separating them makes it
easier to add meaningful cross-references and extend some of the
descriptions.
- Move the part of math(3) that discusses IEEE 754 to the ieee(3)
manpage.


# 140609 22-Jan-2005 das

Add fma() and fmaf(), which implement a fused multiply-add operation.


# 140275 15-Jan-2005 das

amd64 assembly versions of sqrt(), lrint(), and llrint() using SSE2.


# 140195 13-Jan-2005 das

Import the subset of J.T. Conklin's single-precision x86-optimized
math routines that appear to be (a) correct and (b) faster than their
MI counterparts on my Pentium 4.

Obtained from: NetBSD


# 140172 13-Jan-2005 stefanf

Implement and document ceill().


# 140143 12-Jan-2005 stefanf

Hook up and document floorl().


# 140088 11-Jan-2005 das

Add MI implementations of [l]lrint[f]() and [l]lround[f]().

Discussed with: bde


# 136385 11-Oct-2004 stefanf

Add and document ilogbl(), a long double version of ilogb().


# 136027 01-Oct-2004 kensmith

Bump the library version numbers for the following libraries:

/lib/{libm,libreadline}
/usr/lib/{libhistory,libopie,libpcap}

in preparation for doing the same thing to RELENG_5. HUGE amounts of
help for determining what to bump provided by kris.

Discussed on: freebsd-current
Approved by: re (not required for commit but something like this should be)


# 133289 07-Aug-2004 stefanf

Add man pages for the cimag(), conj() and creal() functions.


# 133147 04-Aug-2004 das

Replace s_isnan.c and s_isnanf.c with the more compact s_isnan.c from
libc. The externally-visible effect of this is to add __isnanl() to
libm, which means that libm.so.2 can once again link against libc.so.4
when LD_BIND_NOW is set. This was broken by the addition of fdiml(),
which calls __isnanl().


# 132382 19-Jul-2004 das

Fix two bugs in the signbit() macro, which was implemented last year:

- It was added to libc instead of libm. Hopefully no programs rely
on this mistake.

- It didn't work properly on large long doubles because its argument
was converted to type double, resulting in undefined behavior.


# 131852 09-Jul-2004 das

Implement the classification macros isfinite(), isinf(), isnan(), and
isnormal() the hard way, rather than relying on fpclassify(). This is
a lose in the sense that we need a total of 12 functions, but it is
necessary for binary compatibility because we have never bumped libm's
major version number. In particular, isinf(), isnan(), and isnanf()
were BSD libc functions before they were C99 macros, so we can't
reimplement them in terms of fpclassify() without adding a dependency
on libc.so.5. I have tried to arrange things so that programs that
could be compiled in FreeBSD 4.X will generate the same external
references when compiled in 5.X. At the same time, the new macros
should remain C99-compliant.

The isinf() and isnan() functions remain in libc for historical
reasons; however, I have moved the functions that implement the macros
isfinite() and isnormal() to libm where they belong. Moreover,
half a dozen MD versions of isinf() and isnan() have been replaced
with MI versions that work equally well.

Prodded by: kris


# 131676 06-Jul-2004 das

Add C99's nearbyint{,f}() functions as wrappers around rint().
These trivial implementations are about 25 times slower than
rint{,f}() on x86 due to the FP environment save/restore.
They should eventually be redone in terms of fegetround() and
bit fiddling.


# 131320 30-Jun-2004 das

Implement and document fdim{,f,l}, fmax{,f,l}, and fmin{,f,l}.


# 131001 23-Jun-2004 marcel

s/ARCH/ARCH_SUBDIR/g -- This reduces the chance of possible conflicts
with the user's environment.

Wondered why his cross-builds kept failing: marcel


# 130775 20-Jun-2004 stefanf

Completely remove s_ilogb.S as the assembler implementation gives very little
speed improvement to none at all over the MI version.

Submitted by: bde


# 130769 20-Jun-2004 das

Connect scalbln(), trunc(), and the associated documentation to the build.


# 130179 07-Jun-2004 das

Add round(3) and roundf(3) and the associated documentation.

PR: 59797
Submitted by: "Steven G. Kargl" <kargl@troutmask.apl.washington.edu>
Reviewed by: bde (earlier version, last year)


# 130149 06-Jun-2004 das

Add fenv.h, fenv.c, and the associated documentation to the libm
build. To facilitate this, add ${.CURDIR}/${ARCH} to make's search
path unconditionally.

Reviewed by: standards@


# 129864 30-May-2004 stefanf

Add implementations for cimag{,f,l}, creal{,f,l} and conj{,f,l}. They are
needed for cases where GCC's builtin functions cannot be used and for
compilers that don't know about them.

Approved by: das (mentor)


# 129040 07-May-2004 stefanf

Add an implementation of copysignl(), a long double version of copysign().

Approved by: das (mentor)


# 129038 07-May-2004 stefanf

Add an MLINK for fabsl().

Approved by: das (mentor)


# 121497 25-Oct-2003 des

- fabsl.c should be named s_fabsl.c for consistency with libmsun's
documented naming scheme (unfortunately the documentation isn't in the
tree as far as I can tell); no repocopy is required as there is no
history to preserve.

- replace simple and almost-correct implementation with slightly hackish
but definitely correct implementation (tested on i386, alpha, sparc64)
which requires pulling in fpmath.h and the MD _fpmath.h from libc.

- try not to make a mess of the Makefile in the process.

- enterprising minds are encouraged to implement more C99 long double
functions.


# 121419 23-Oct-2003 des

Connect fabsl.c to the build.


# 119017 17-Aug-2003 gordon

Stage 3 of dynamic root support. Make all the libraries needed to run
binaries in /bin and /sbin installed in /lib. Only the versioned files
reside in /lib, the .so symlink continues to live /usr/lib so the
toolchain doesn't need to be modified.


# 117917 23-Jul-2003 bde

Fixed some style bugs (misplacement and misformatting of some commented-out
code).


# 117912 23-Jul-2003 peter

Only provide one copy of the math functions. If we provide a MD function,
do not also provide a __generic_XXX version as well. This is how we
used to runtime select the generic vs i387 versions on the i386 platform.

This saves a pile of #defines in the src/math_private.h file to undo the
__generic_XXX renames in some of the *.c files.


# 117910 23-Jul-2003 peter

No longer need the internal __get_hw_float() function.


# 117909 23-Jul-2003 peter

Now that we do not need to do runtime detection for the broken default
fp emulator, stop doing the runtime selection of hardware or emulated
floating point operations on i386. Note that I have not suppressed the
duplicate compiles yet.

While here, fix the alpha. It has provided specific copysign/copysignf
functions since the beginning of time, but they have never been used.


# 96462 12-May-2002 ru

Added new bsd.incs.mk which handles installing of header files
via INCS. Implemented INCSLINKS (equivalent to SYMLINKS) to
handle symlinking include files. Allow for multiple groups of
include files to be installed, with the powerful INCSGROUPS knob.
Documentation to follow.

Added standard `includes' and `incsinstall' targets, use them
in Makefile.inc1. Headers from the following makefiles were
not installed before (during `includes' in Makefile.inc1):

kerberos5/lib/libtelnet/Makefile
lib/libbz2/Makefile
lib/libdevinfo/Makefile
lib/libform/Makefile
lib/libisc/Makefile
lib/libmenu/Makefile
lib/libmilter/Makefile
lib/libpanel/Makefile

Replaced all `beforeinstall' targets for installing includes
with the INCS stuff.

Renamed INCDIR to INCSDIR, for consistency with FILES and SCRIPTS,
and for compatibility with NetBSD. Similarly for INCOWN, INCGRP,
and INCMODE.

Consistently use INCLUDEDIR instead of /usr/include.

gnu/lib/libstdc++/Makefile and gnu/lib/libsupc++/Makefile changes
were only lightly tested due to the missing contrib/libstdc++-v3.
I fully tested the pre-WIP_GCC31 version of this patch with the
contrib/libstdc++.295 stuff.

These changes have been tested on i386 with the -DNO_WERROR "make
world" and "make release".


# 93211 26-Mar-2002 bde

Resurrect Lite1's gamma() as C99's tgamma(). Minimal changes.


# 91514 28-Feb-2002 obrien

We need an frexp() function.


# 87804 13-Dec-2001 phantom

* remove reference to m68k-dependent sources
* fix comment


# 84403 03-Oct-2001 bde

Don't install manpage links for the nonexistent functions exp2(),
exp2f(), log2() and log2f().


# 74870 27-Mar-2001 ru

MAN[1-9] -> MAN.


# 74804 26-Mar-2001 ru

Don't use MANDEPEND and MANSRC.


# 50476 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 42044 24-Dec-1998 dfr

Disable building with alpha software completion options until we upgrade
compilers.


# 42029 23-Dec-1998 dfr

Implement fpsetmask() and other fp*() functions. Programs should use

#include <ieeefp.h>

to access these functions instead of the i386 specific

#include <machine/floatingpoint.h>

Submitted by: Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>


# 33662 20-Feb-1998 jb

Add alpha support. m68k crept in too. Oops. 8-)


# 24964 15-Apr-1997 bde

Added -D_ARCH_INDIRECT=i387_ to CFLAGS. _ARCH_INDIRECT will soon be used
to control generation of indirections in ENTRY(). Only msun needs it.

Use ${ARCH} consistently.


# 22993 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 22948 20-Feb-1997 bde

Split up the Bessel function wrapper files so that most wrapper functions
are in their own file.


# 22808 16-Feb-1997 bde

Select between the generic math functions and the i387-specific ones
at runtime.

etc/make.conf:
Nuked HAVE_FPU option.

lib/msun/Makefile:
Always build the i387 objects. Copy the i387 source files at build
time so that the i387 objects have different names. This is simpler
than renaming the files in the cvs repository or repeating half of
bsd.lib.mk to add explicit rules.

lib/msun/src/*.c:
Renamed all functions that have an i387-specific version by adding
`__generic_' to their names.

lib/msun/src/get_hw_float.c:
New file for getting machdep.hw_float from the kernel.

sys/i386/include/asmacros.h:
Abuse the ENTRY() macro to generate jump vectors and associated code.
This works much like PIC PLT dynamic initialization. The PIC case is
messy. The old i387 entry points are renamed. Renaming is easier
here because the names are given by macro expansions.


# 22748 15-Feb-1997 jkh

Put back .endif clobbered by the previous commit, breaking the
build.


# 22731 15-Feb-1997 bde

Disabled the i387 version if log1p(). It just evaluates log(1 + x).
This defeats the point of log1p(). ucbtest reports errors of +-5e+15
ULPs. A correct version would use the i387 fyl2xp1 instruction for
small x and maybe scale to small x. The C version does the scaling
reasonably efficiently, and fyl2px1 is slow (at least on P5s), so not
much is lost by always using the C version (only 25% for small x even
with the broken i387 version; 50% for large x).


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 21435 08-Jan-1997 wollman

Delete -D_POSIX_MODE and -D_MULTI_LIBM from CFLAGS. They never had any effect
because _IEEE_LIBM always takes priority, so the definition just served
to confuse.

Reviewed by: bde


# 17958 30-Aug-1996 peter

consistancy fixup

Submitted by: "Philippe Charnier" <charnier@xp11.frmug.org>


# 17935 30-Aug-1996 peter

cmp -s || install -c ==> install -C


# 13988 08-Feb-1996 mpp

Correct one small typo in previous commit.


# 13987 08-Feb-1996 mpp

Added some missing MLINKS for section 3 man pages.
Also corrected a few minor formatting errors, file location and cross
references in some of the section 3 man pages.

This shuts up a lot of the output from "manck" for section 3.


# 11682 22-Oct-1995 bde

Undo the the changes in the previous revision (MANSRC now works right again).
Use ${INSTALL} instead of install.


# 11136 02-Oct-1995 wollman

Compress manual pages (if desired) in the obj directory rather
than in the installation destination. Should make release-building
substantially faster. The msun Makefile changes simple adapt to the new
scheme.


# 8870 30-May-1995 rgrimes

Remove trailing whitespace.


# 6953 07-Mar-1995 bde

Obtained from: NetBSD

Remove common sources from ${SRCS} when they are replaced by arch-specific
sources.


# 2574 08-Sep-1994 bde

Install math.h.


# 2122 19-Aug-1994 jkh

Make this puppy actually compile now.
Submitted by: jkh


# 2117 19-Aug-1994 jkh

This commit was generated by cvs2svn to compensate for changes in r2116,
which included commits to RCS files with non-trunk default branches.


# 2116 19-Aug-1994 jkh

J.T. Conklin's latest version of the Sun math library.

-- Begin comments from J.T. Conklin:
The most significant improvement is the addition of "float" versions
of the math functions that take float arguments, return floats, and do
all operations in floating point. This doesn't help (performance)
much on the i386, but they are still nice to have.

The float versions were orginally done by Cygnus' Ian Taylor when
fdlibm was integrated into the libm we support for embedded systems.
I gave Ian a copy of my libm as a starting point since I had already
fixed a lot of bugs & problems in Sun's original code. After he was
done, I cleaned it up a bit and integrated the changes back into my
libm.
-- End comments

Reviewed by: jkh
Submitted by: jtc