161 Commits

Author SHA1 Message Date
Sergey Fedorov
d9f2b0f21a
Minor fix-ups for Darwin PowerPC (#303)
* openlibm_fenv.h: fix PowerPC macro for Darwin

* openlibm_fenv_powerpc.h: check if __BYTE_ORDER__ is actually defined

* fpmath.h: fix PowerPC macro for Darwin
2024-06-19 15:01:51 -04:00
A1phaN
eb5330efad
Support for loongarch64 architecture (#280)
* Support for loongarch64 architecture

* fix compile error
2024-01-10 09:53:48 +05:30
MarcusCalhoun-Lopez
12f5ffcc99
Fix Apple PowerPC build (#276)
Apple versions of GCC define __ppc__ instead of __powerpc__

Fixes #275
2023-06-24 23:26:52 -04:00
Keno Fischer
1d2c5e3bf5
Restore original fdlibm copyright on sincos files (#265)
These files are derived from the original fdlibm sin/cos files.
While we do already preserve that license notice in LICENSE.md
(so there's no actual license compliance issue here), it's
cleaner to have the copyright notice in the file as well, in
case somebody copies the file out of the repo.
2022-10-18 11:58:47 -07:00
xctan
428e7af214
Support for riscv64 architecture (#254)
Changes needed for riscv64 support have been added.
Code for openlibm_fenv_riscv.h, riscv_fpmath.h and fenv.c
was taken from https://github.com/freebsd/freebsd
2021-11-09 21:31:45 -05:00
jeremyd2019
69bb2804da
Another Windows ARM64 fix (#253)
* Another Windows ARM64 fix

include stdint.h to be sure that uint64_t can be used.
This header already had references to uint32_t, so I assumed it was safe to use those typedefs, but a compile error revealed it was not always.

* fix munged whitespace
2021-09-11 08:00:13 -04:00
jeremyd2019
3d4a902f31
Fixes for Windows ARM64 (#251)
* aarch64_fpmath.h: deal with LLP64 (Windows ARM64)

use uint64_t instead of unsigned long, as unsigned long is only 32 bits on Windows

* Make.inc: WINNT aarch64 long double is double

Add to list along with Darwin
2021-09-10 00:09:04 -04:00
jeremyd2019
d0ef09a62d
prefix symbols with _ for 32-bit x86 Windows (#242)
In a case that I believe can only be hit for Clang i686-*-windows-gnu (AKA MinGW), symbols in asm need to be prefixed with `_`.  Fixes #237
2021-09-09 19:04:44 -04:00
Viral B. Shah
4bca0f29b8
Revert "prefix symbols with _ for 32-bit x86 Windows" 2021-09-08 13:35:31 -04:00
Viral B. Shah
3b9454fd7c
Merge pull request #238 from jeremyd2019/patch-1
prefix symbols with _ for 32-bit x86 Windows
2021-09-08 13:34:49 -04:00
Viral B. Shah
6ae63186e7
Update src/cdefs-compat.h
Co-authored-by: Elliot Saba <staticfloat@gmail.com>
2021-09-08 13:04:35 -04:00
Viral B. Shah
71a8fd1ccb
Merge pull request #233 from lephe/more-long-double-aliases
Add missing aliases for 64-bit long double functions
2021-09-08 08:31:00 -04:00
jeremyd2019
7a3ef59cdb
prefix symbols with _ for 32-bit x86 Windows
In a case that I believe can only be hit for Clang i686-*-windows-gnu (AKA MinGW), symbols in asm need to be prefixed with `_`.  Fixes #237
2021-09-07 10:51:31 -07:00
Viral B. Shah
a87145707f
Merge pull request #230 from PetteriAimonen/master
Replace remaining __strong_alias uses
2021-09-06 23:42:07 -04:00
Viral B. Shah
a090d3e614 Fix powf: https://github.com/JuliaMath/openlibm/issues/212#issuecomment-913729312 2021-09-07 03:35:33 +00:00
Lephenixnoir
57dd0f905d
add missing weak references for long double functions
This ensures that all standard long double functions are defined when
building with 64-bit long double.
2021-05-20 23:31:35 +02:00
Petteri Aimonen
327b1bdcde Replace remaining __strong_alias uses 2021-03-10 17:25:28 +02:00
Steven G. Kargl
711654eeab
Fix incorrect results in hypotl near underflow
Fixes #224.
2021-02-10 12:44:19 -08:00
Viral B. Shah
aeab19f47e Fix for #211
Co-authored by: @kargl
2021-02-08 09:39:30 -05:00
Viral B. Shah
98f87135b0 Fix #211
Patched by importing latest msun version
2021-02-06 18:10:09 -05:00
Viral B. Shah
40dac9dd77 Restore STRICT_ASSIGN on FreeBSD as suggested in #215
Co-authored-by: @kargl
2021-02-06 17:27:15 -05:00
Keno Fischer
b34f107e24
Fix Apple Silicon build (#214)
My previous Apple Silicon build went through, so I thought it already
worked, but it turns out it accidentally built an armv7 build instead.
This actually fixes the Apple Silicon build. One thing to note in
particular is that on Apple Silicong `long double` is the same as
`double` while on Linux `long double` is a 128 bit double-double
format.

Co-authored-by: Elliot Saba <staticfloat@gmail.com>
2020-09-03 18:27:17 -04:00
Viral B. Shah
0276147a68
Merge pull request #209 from embeddedartistry/master
Refactor: OLM_DLLEXPORT definition now lives in a standalone header.
2020-08-29 11:12:57 -04:00
Keno Fischer
4f559d4c14
Replace a few remaining __strong_reference uses (#210)
__strong_alias is an ELF feature that is not available on Darwin/MachO.
We have openlibm_strong_reference to paper over these differences,
but we weren't using it consistently. In particular, we were still
using it to define long double -> double aliases on platforms where
these are the same type (e.g. aarch64). This didn't used to matter,
because the only such platform we supported was always Linux and
thus ELF. This patch fixes these instances thus fixing the build
on Apple Silicon.
2020-07-09 15:51:12 -04:00
Phillip Johnston
0418324ca4 Refactor: OLM_DLLEXPORT definition now lives in a standalone header.
On x86_64, openlibm_fenv.h is silently coupled to openlibm_complex.h due to the inclusion of math_private.h inside of openlibm_fenv_amd64.h. The math_private.h header was included to gain access to the OLM_DLLEXPORT macro. However, this macro is redefined, since it is originally defined in openlibm_math.h. This inclusion also exposes math_private.h to public clients, which is undesirable.

Instead, a standalone header is created to contain the OLM_DLLEXPORT definition. This header is used included in the appropriate files. openlibm_fenv_amd64.h is no longer coupled to math_private.h.
2020-06-10 15:57:08 -07:00
llucinat
f952e167d2 Fix weak reference macro redefinition in wasm32 target 2019-11-14 08:41:10 +01:00
gufe44
c4dca1e84a
Add files via upload 2019-10-26 01:53:42 +02:00
gufe44
d4077aa131
Suggestions
https://github.com/JuliaMath/openlibm/pull/197#pullrequestreview-307404318
2019-10-26 01:05:27 +02:00
gufe44
ea065f90cb
Update src/cdefs-compat.h
Co-Authored-By: Jameson Nash <vtjnash@gmail.com>
2019-10-25 23:45:13 +02:00
gufe44
2080b23690
NetBSD fix 2019-10-25 18:32:47 +02:00
Daniel Mendler
72f33a3bf9 wasm32 support (#192) 2019-04-14 15:11:03 -07:00
Jeremy Soller
f24b1bfe55 Fix compilation of gcc when using openlibm as system libm (#190)
For some sad reason, gcc poisons LONG_DOUBLE in sreal.c. The identifier has been changed to OLM_LONG_DOUBLE.
2019-01-14 11:53:14 -08:00
Dan Horák
2a1e56858a s390(x) port 2018-11-07 12:11:15 +01:00
Viral B. Shah
73b3d88ef1
Merge pull request #181 from CDLuminate/mipsport
Updated MIPS port
2018-06-18 16:01:04 -04:00
Radovan Birdic
4f5112ea59 Support for mips architectures
Changes needed for mips suport have been added.
Code for openlibm_fenv_mips.h, mips_fpmath.h and fenv.c
was taken from https://github.com/freebsd/freebsd
2018-06-04 09:38:27 +00:00
Jeff Walden
787652b054
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.

Incorporated from FreeBSD source tree. See:
b21ccf63f2
2018-04-07 10:35:06 -07:00
Alex Arslan
72bfab46a0
Avoid redefining macros defined by the system
In particular, OpenBSD already defines __GNUC_PREREQ__, __BEGIN_DECLS,
and __warn_references. Hiding the definitions behind #ifndef guards
avoids warnings when building.
2018-04-06 14:41:06 -07:00
Takuya Nakaoka
d134c84e91 Fix reversed outputs of sincosl 2018-01-26 15:33:30 +09:00
Patrick Kofod Mogensen
3db5e546e4
Minor typo in expm1 comment
`exp(+-inf)={inf, 0}`, so...
2017-11-30 13:19:33 +01:00
Alex Arslan
c3968ca11f Allow building on DragonFly BSD (#167) 2017-09-22 13:22:43 -07:00
Martin Lucina
b5b63ba66d Enable long double functions for aarch64
Per discussion in #157, it is correct to enable these for aarch64.
2017-07-27 13:29:33 +00:00
Elliot Saba
c21453060d Cleanup ARCH handling, reorganize AArch64 and Make.inc.
* Previously, behavior differed if the same value of `ARCH` was defined
  within `Make.inc` or defined on the command line.  Don't do that.

* Provide saner defaults for `ARCH` and `MARCH`, and more importantly,
  allow for the proper overriding of both.

* Split `AArch64` code further away from the other `arm` code.
2017-01-16 11:44:14 -08:00
Keno Fischer
5fd9dcbbdf Fix incorrect attribute as a result of blanket rename 2016-05-03 18:48:45 -04:00
Keno Fischer
28fb939b0d Blanket rename DLLEXPORT->OLM_DLLEXPORT 2016-03-13 21:07:55 -04:00
Keno Fischer
81053b7fcb Fix Clang warnings on Windows
- Align DLLEXPORT in definitions and declations. There is still a few
  cases left, where the declation in the compiler's complex.h disagrees
  with the implementation here. For now we can't do anything about that,
  but maybe should be revisited in the future.
- Fix the syntax on an .ascii directive that gcc accepted mistakingly, but
  clang does not.
2016-03-13 06:21:15 +00:00
Milan Bouchet-Valat
e836b30cc7 Avoid defining __pure2 if already defined
This gets rid of a warning on Mac OS X due to the fact that
sys/cdefs.h defines it already.
2016-03-08 10:34:20 +01:00
Milan Bouchet-Valat
226faf4e11 Avoid redefining __pure2 in types-compat 2016-03-03 17:05:12 +01:00
Milan Bouchet-Valat
2c3f3b5a99 Cleanup bsd_cdefs.h, merge i387 and amd64 duplicate files
Most macros were not actually used. This gets rid of warnings when
building on Linux.
2016-03-02 21:21:25 +01:00
Milan Bouchet-Valat
b5ca785d4c Avoid redefining endianness macros with some gcc versions
_LITTLE_ENDIAN and _BIG_ENDIAN are built-in on some platforms/versions.
Better use __ORDER_LITTLE_ENDIAN__, __ORDER_BIG_ENDIAN__ and __BYTE_ORDER__,
which are standard for gcc and clang, and define them when they are missing.
Also remove the special-case for FreeBSD, which is apprently not needed.
2016-03-02 21:21:25 +01:00
Milan Bouchet-Valat
949c530994 Fix misleading indentation (spotted by GCC 6) 2016-03-02 21:21:25 +01:00