Bez popisu

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

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.