Không có mô tả

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

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.