-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d729b7
commit 4605b93
Showing
12 changed files
with
1,212 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,6 @@ | |
/target | ||
/tests | ||
Cargo.lock | ||
# libm-c-abi tests folders | ||
libc-test | ||
openlibm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "relibm" | ||
version = "0.1.0" | ||
authors = ["augustin <cheron.augustin@gmail.com>"] | ||
description = "Expose rust libm functions in a c abi compatible library. This is highly experimental. This crate is for test purpose only." | ||
edition = "2018" | ||
license = "MIT OR Apache-2.0" | ||
|
||
[lib] | ||
crate-type = ["staticlib", "cdylib"] | ||
|
||
[dependencies] | ||
libm = { path = "../.." } | ||
libc = {version="0.2", default-features=false} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
mkfile_dir := $(dir $(mkfile_path)) | ||
|
||
ifndef CARGO_TARGET_DIR | ||
override CARGO_TARGET_DIR = "../" | ||
endif | ||
CRATE_RELEASE_DIR := $(CARGO_TARGET_DIR)release | ||
LDLIBS += -L $(CRATE_RELEASE_DIR) -lrelibm -Wl,-rpath=$(CRATE_RELEASE_DIR) | ||
|
||
all: shared | ||
|
||
shared: | ||
clang simple.c $(LDLIBS) | ||
static: | ||
clang simple.c $(CRATE_RELEASE_DIR)/librelibm.a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Simple test program. | ||
* You can use it to debug test case outside the test suite. | ||
* This is usefull to debug in parallel the C and rust version, to float debug precision issue. | ||
*/ | ||
#include <math.h> | ||
#include <stdio.h> | ||
|
||
int main(void) | ||
{ | ||
double res = y0(0x1.c982eb8d417eap-1); | ||
double want = -0x1.af74bfa0f1304p-56; | ||
double got = -0x1p-55; | ||
printf("want: %a : got : %a\ngot in test : %a\n", want, res, got); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
mod lib_f32; | ||
mod lib_f64; | ||
mod lib_fenv; | ||
mod lib_long_double; | ||
|
||
pub use lib_f32::*; | ||
pub use lib_f64::*; | ||
pub use lib_fenv::*; | ||
pub use lib_long_double::*; | ||
|
||
#[no_mangle] | ||
pub static mut signgam: i32 = 0; |
Oops, something went wrong.