Sin descripción

Jeremy Soller f5ed774593 Fix missing functions on riscv64 hace 1 mes
.github 319b5f241c Bump actions/checkout from 4 to 5 (#335) hace 1 mes
aarch64 9fbeafcd4f Fix BSD-specific types on Linux for aarch64 (#329) hace 5 meses
amd64 e2482c959e Add stack markings for GNU to fmod assembly files (#307) hace 1 año
arm 388f0f1d32 Remove unused Symbol.map files. hace 10 años
bsdsrc 57dd0f905d add missing weak references for long double functions hace 4 años
docs 3cfad14805 Update index.html hace 7 meses
i387 ae2d916985 Correctly round double precision sqrt (#256) hace 3 años
include 4d375a922f Include cdefs-compat.h on s390 and powerpc hace 4 meses
ld128 238a90959f Fix compilation on AArch64 hace 8 años
ld80 aeaf9cefa7 Fix undefined reference to __fpgetprec on i386 hace 9 años
loongarch64 c4667caea2 Fix fenv_t initializer (#308) hace 11 meses
mips 4dcc76ed96 Using cdefs-compat.h and stdint.h instead <sys/types.h> hace 7 años
powerpc 63aa8757f3 Make fenv methods static on additional platforms. hace 4 años
riscv64 c9c6fd6ead Update riscv64 fenv.c initialization to fix warnings (#330) hace 4 meses
s390 2a1e56858a s390(x) port hace 7 años
src f5ed774593 Fix missing functions on riscv64 hace 1 mes
test 60dec83e33 msys2 ci (#243) hace 4 años
wasm32 72f33a3bf9 wasm32 support (#192) hace 6 años
.gitignore d463259eaa ci: test with openlibm-test (#327) hace 5 meses
.mailmap f5d2bc53f9 Add mailmap hace 13 años
CMakeLists.txt 2fba53e3ec cmake: Fix cmake error for 4.x (#333) hace 2 meses
LICENSE.md ce69bf1f32 Update references to JuliaLang to point to JuliaMath (#182) hace 7 años
Make.inc 4d2d83fdec Add a Vim filetype hint for Make.inc alongside that for Emacs hace 9 meses
Makefile d463259eaa ci: test with openlibm-test (#327) hace 5 meses
README.md 87e5f0b3f2 CMake updates (#302) hace 1 año
openlibm.pc.in acf58d235e build: fix pkgconfig cflags and libdir variables (#284) hace 1 año

README.md

OpenLibm

codecov

OpenLibm is an effort to have a high quality, portable, standalone C mathematical library (libm). It can be used standalone in applications and programming language implementations.

The project was born out of a need to have a good libm for the Julia programming language that worked consistently across compilers and operating systems, and in 32-bit and 64-bit environments.

Platform support

OpenLibm builds on Linux, macOS, Windows, FreeBSD, OpenBSD, NetBSD, and DragonFly BSD. It builds with both GCC and clang. Although largely tested and widely used on the x86 and x86-64 architectures, OpenLibm also supports arm, aarch64, ppc64le, mips, wasm32, riscv, s390(x) and loongarch64.

Build instructions

GNU Make

  1. Use GNU Make to build OpenLibm. This is make on most systems, but gmake on BSDs.
  2. Use make USEGCC=1 to build with GCC. This is the default on Linux and Windows.
  3. Use make USECLANG=1 to build with clang. This is the default on OS X, FreeBSD, and OpenBSD.
  4. Use make ARCH=wasm32 to build the wasm32 library with clang.
  5. Architectures are auto-detected. Use make ARCH=i386 to force a build for i386. Other supported architectures are i486, i586, and i686. GCC 4.8 is the minimum requirement for correct codegen on older 32-bit architectures.

Cross Build Take riscv64 as example:

  1. install qemu-riscv64-static, gcc-riscv64-linux-gnu
  2. Cross build:

    ARCH=riscv64
    TRIPLE=$ARCH-linux-gnu
    make ARCH=$ARCH TOOLPREFIX=$TRIPLE-  -j
    make -C test ARCH=$ARCH TOOLPREFIX=$TRIPLE-  -j
    
  3. Run test with qemu:

    qemu-$ARCH-static -L . -L /usr/$TRIPLE/  test/test-float
    qemu-$ARCH-static -L . -L /usr/$TRIPLE/  test/test-double
    

CMake

  1. Create build directory with mkdir build and navigate into it with cd build.
  2. Run CMake to configure project and generate native build system with cmake /path/to/openlibm/ or generate project with build system of choice e.g. cmake /path/to/openlib/ -G "MinGW Makefiles".
  3. Build with the build system with cmake --build ..

Default CMake configuration builds a shared library, this can easily be configured using BUILD_SHARED_LIBS configuration option.

Acknowledgements

PowerPC support for openlibm was graciously sponsored by IBM.