summaryrefslogtreecommitdiff
path: root/lib/libm
AgeCommit message (Collapse)Author
2024-06-17Fix typo: s/fetesteexcept/fetestexcept/Tim van der Molen
2024-05-01add return statements missed when adapting from FreeBSDJonathan Gray
Avoids segfaults with an argument of 0, NaN, or Inf. Problem reported by Colin Ian King. ok miod@ kettenis@
2024-03-29Simplify the conditionals for architectures which do not need any particularMiod Vallat
md files lists. ok guenther@ deraadt@
2024-03-04Bring back the fabsf strong alias to fabs, lost sometime ago duringMiod Vallat
libm symbol visibility rework. This would warrant a libm.so minor bump, but as 7.5 packages build have started, this won't happen (and hopefully noone will notice since this only affects landisk). ok deraadt@
2023-09-07convert to ansi function declJonathan Gray
2023-08-13Make sure modff() returns correct values for infinities.Miod Vallat
Reported by Willemijn Coene.
2023-01-27Use the same inline assembly constraints as for libc fp*(), when operatingMiod Vallat
on the floating-point control register.
2023-01-27Remove fast round(3) implementation for hppa. It is a nice idea, but does notMiod Vallat
round in the right direction for halfway values. (noticed in the perl test results thanks to afresh1@)
2022-12-27spelling fixes; from paul tagliamonteJason McIntyre
any changes not taken noted on tech, but chiefly here i did not take the cancelation - cancellation changes;
2022-08-29use ansi volatile keyword, not __volatileJonathan Gray
ok miod@ guenther@
2022-08-27Use ENTRY_NB() instead of ENTRY()Theo Buehler
Since llvm 13, there are compiler warnings in libm on amd64 and i386 due to .weak overriding an earlier .globl. Use ENTRY_NB() instead of ENTRY() to avoid emitting the .globl. ok deraadt jca (for amd64) ok guenther
2022-07-25If a command or interface first appeared in PWB/UNIX, UNIX System III orJonathan Gray
UNIX System V mention it. Only do so in manual pages with a pre-existing HISTORY section. Prompted by the comparison of System V and BSD commands and interfaces in Sun's "System V Enhancements Overview" document. checked against manuals on bitsavers, TUHS archive and CSRG archive CDs ok jmc@ schwarze@
2022-03-29man pages: add missing word, The foo() ... -> The foo() function ...Christian Weisgerber
ok jmc@ schwarze@
2022-03-29man pages: add missing commas in enumerationsChristian Weisgerber
2022-02-05Provide logbl(3) when long double is doubleGeorge Koehler
bcallah@ had same diff ok guenther@
2022-01-21Optimization for tiny x in cos and sinGreg Steuck
Subset of FreeBSD commit 4339c67c485f0b1f7699863fc29f6c06862d1dde: Moved the optimization for tiny x from __kernel_{cos,sin}[f](x) to {cos_sin}[f](x) so that x doesn't need to be reclassified in the "kernel" functions to determine if it is tiny (it still needs to be reclassified in the cosine case for other reasons that will go away). ... Parts of the original change were applied separately before. Suggested by kettenis@ OK mbuhl@, tested by mbuhl@ and phessler@
2022-01-21Unplug assembly implementations of trig functions on x86 platformsGreg Steuck
The same change was done by NetBSD some time back as: Disable x87 implementations of sin, cos, tan. The x87 hardware uses a bad approximation to pi for argument reduction, and consequently yields bad answers for inputs near pi or pi/2. OK mbuhl@, tested by mbuhl@ and phessler@
2022-01-21Copy cos(3) software implementation from FreeBSD-13Greg Steuck
The result passes more tests from msun suite. In particular, testacc(cos, -0.34061437849088045332L, 0.94254960031831729956L, ALL_STD_EXCEPT, FE_INEXACT); matches instead of being 1e-16 off. OK mbuhl@, tested by mbuhl@ and phessler@
2021-10-14Replace lrint(3), lrintf(3), llrint(3) and llrintf(3) implementations withMark Kettenis
the same implementation that we're already using for lrintl(3) and llrintl(3). The old implementations were derived from code from NetBSD that didn't pass the lib/libm/msun/lrint_test regress test. NetBSD replaced their implementation with the FreeBSD implementation of this code which we were already using for lrintl(3) and llrintl(3). This fixes the regress test. ok bluhm@, millert@
2021-09-17sys/param.h is not needed in this fileTheo de Raadt
2021-06-29function args must not use .Ar and EDOM and ERANGE require .Er;Ingo Schwarze
mostly mechanical diff similar to what Emil Engler just sent for sqrt(3)
2021-06-29insert missing .NsIngo Schwarze
2021-06-29basic mdoc(7) macro cleanup; patch from me at EmilEngler dot comIngo Schwarze
2021-05-31Revert previous. bluhm noted that it causes a regress failure.Theo Buehler
2021-05-28Silence a clang warning on loss of precisionTheo Buehler
When converting a long or long long to a double, there may be loss of precision and clang >= 10 warns about this unless there is a cast. Add casts to silence this warning - the code is designed to handle precisely this loss of precision, so this is harmless. From CheriBSD via FreeBSD ok millert
2021-05-12Correct defines for fenv rounding modes and change fenv_t and fexcept_tJonathan Gray
from unsigned long long to unsigned int. ok kettenis@
2021-05-11use FE_ALL_EXCEPT not _ROUND_MASK when masking fcsr exception bitsJonathan Gray
2021-04-27riscv64 additions for libmDale Rahn
ok kettenis@
2020-11-14remove macro instances from arbitrary string width specifiers. for exampleJason McIntyre
-width ".Dv BOB" -> -width "BOB" although they are not errors, they are misleading and probably should not get pasted around
2020-11-07Fix ilogb(3) implementation. The results have to match FP_ILOGB0 andMark Kettenis
FP_ILOGBNAN which isn't the case for the amd64 and i386 assembly versions. Drop these in favour of C implementations. Als reimplement ilogbl(3) by providing separate ld80 and ld128 implementations that replace the existing implementation which may hit an infinite loop when built for quad-precision long double. ok patrick@, gkoehler@
2020-11-07Fix ilogb(3) implementation. The results have to match FP_ILOGB0 andMark Kettenis
FP_ILOGBNAN which isn't the case for the amd64 and i386 assembly versions. Drop these in favour of C implementations. Als reimplement ilogbl(3) by providing separate ld80 and ld128 implementations that replace the existing implementation which may hit an infinite loop when built for quad-precision long double. ok patrick@, gkoehler@
2020-10-31Align with C99 (and our implementation) and describe the return values forMark Kettenis
NaN and 0 arguments using FP_ILOGB0 and FP_ILOGBNAN.
2020-07-09The fegetexceptflag() function should not have a DEF_STD.Mark Kettenis
Brings arm64 in line with all the other architectures. ok millert@
2020-06-28Add powerpc64 support.Mark Kettenis
2020-06-28Add powerpc64 fenv bits; copied from powerpc. From drahn@Mark Kettenis
2020-02-08correct Research Unix edition "appeared in" use in HISTORYJonathan Gray
Starting from "Combined Table of Contents" in Doug McIlroy's "A Research UNIX Reader" a table of which edition manuals appeared in. Checked against manuals from bitsavers/TUHS and source from TUHS where available. Ingo points out there are cases where something is included but not documented until a later release. bcd(6) v6 v7 printf(3) v2 v4 abort(3) v5 v6 system(3) v6 v7 fmod(3) v5 v6 ok schwarze@
2019-10-30Fix declaration of S1 by swapping misplaced ',' and ';'.Theo Buehler
This is inside !(defined(__amd64__) || defined(__i386__)), while the file is only used on those two architectures. "Free commit! No strings attached! No hidden tricks!" from miod
2019-09-06More Version 1 AT&T UNIX history.Ingo Schwarze
This became possible because copies of the original v1 manuals have shown up on the Internet some time ago. Reminded by Sevan Janiyan <venture37 at geeklan dot co dot uk>.
2019-04-01repair confusing "} if" indentation as suggested by deraadt@Christian Weisgerber
2019-03-15Remove FBSDID.Kevin Lo
ok deraadt@
2019-03-12Setting and getting the rounding mode on our arm64 FPU has not workedPatrick Wildt
in libm since the rounding mode is in fpcr, not fpsr. Since both FPU registers are 32-bit we can store them in the 64-bit fenv_t to make handling the bits easier. While there add FE_DENORMAL, which also exists on x86. Also make sure that whenever we are being passed an exception mask, we only allow the bits that are supported by hardware. Found by regression tests Debugged with Moritz Buhl ok kettenis@
2019-01-25I am retiring my old email address; replace it with my OpenBSD one.Todd C. Miller
2018-07-18Remove the unused leftovers of the 4.4BSD libm, which was only usedChristian Weisgerber
on non-IEEE platforms. Since the VAX port was discontinued, all our remaining architectures use IEEE floating point, as will any future ones. ok millert@ tb@
2018-07-08Add missing retguard checkmortimer
ok deraadt
2018-07-03Add retguard macros to libm assembly.mortimer
ok deraadt
2018-03-16improve markup quality in the cases found by the new "--" style messageIngo Schwarze
2018-03-16Since most (if not all) ARMv8 hardware doesn't actually support trapping ofMark Kettenis
floating-point exceptions, simplify the functions that control the exception masks just like we did on armv7. ok tom@
2018-03-12Gah, rintl() is used internally, so add a macro for the fourth possiblity,Philip Guenther
a cloning a non-standard, long double function which _is_ used from the matching plain double function build failured pointed out by deraadt@
2018-03-12Make the binding of rintl, significand, and significandf consistentlyPhilip Guenther
'weak' in the static libm.a ok deraadt@
2018-03-12Add cvs tag, copyright, and licensePhilip Guenther