Нема описа

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

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.