-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add libm support #37
add libm support #37
Changes from all commits
9611bf1
3c9a9fb
33c2011
74fd3ea
b23c1ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
#![allow(dead_code)] | ||
|
||
#[no_mangle] | ||
pub extern "C" fn acos(n: f64) -> f64 { | ||
libm::acos(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn acosf(n: f32) -> f32 { | ||
libm::acosf(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn acosh(x: f64) -> f64 { | ||
libm::acosh(x) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn acoshf(x: f32) -> f32 { | ||
libm::acoshf(x) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn asin(n: f64) -> f64 { | ||
libm::asin(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn asinf(n: f32) -> f32 { | ||
libm::asinf(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn asinh(x: f64) -> f64 { | ||
libm::asinh(x) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn asinhf(x: f32) -> f32 { | ||
libm::asinhf(x) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn atan(n: f64) -> f64 { | ||
libm::atan(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn atan2(a: f64, b: f64) -> f64 { | ||
libm::atan2(a, b) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn atan2f(a: f32, b: f32) -> f32 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I revise the PR |
||
libm::atan2f(a, b) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn atanf(n: f32) -> f32 { | ||
libm::atanf(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn cbrt(n: f64) -> f64 { | ||
libm::cbrt(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn cbrtf(n: f32) -> f32 { | ||
libm::cbrtf(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn ceil(x: f64) -> f64 { | ||
libm::ceil(x) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn ceilf(x: f32) -> f32 { | ||
libm::ceilf(x) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn cos(x: f64) -> f64 { | ||
libm::cos(x) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn cosf(x: f32) -> f32 { | ||
libm::cosf(x) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn cosh(x: f64) -> f64 { | ||
libm::cosh(x) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn coshf(x: f32) -> f32 { | ||
libm::coshf(x) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn exp(x: f64) -> f64 { | ||
libm::exp(x) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn expf(x: f32) -> f32 { | ||
libm::expf(x) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn expm1(n: f64) -> f64 { | ||
libm::expm1(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn expm1f(n: f32) -> f32 { | ||
libm::expm1f(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn fdim(a: f64, b: f64) -> f64 { | ||
libm::fdim(a, b) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn fdimf(a: f32, b: f32) -> f32 { | ||
libm::fdimf(a, b) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn hypot(x: f64, y: f64) -> f64 { | ||
libm::hypot(x, y) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn hypotf(x: f32, y: f32) -> f32 { | ||
libm::hypotf(x, y) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn log(x: f64) -> f64 { | ||
libm::log(x) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn logf(x: f32) -> f32 { | ||
libm::logf(x) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn log1p(n: f64) -> f64 { | ||
libm::log1p(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn log1pf(n: f32) -> f32 { | ||
libm::log1pf(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn sinh(n: f64) -> f64 { | ||
libm::sinh(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn sinhf(n: f32) -> f32 { | ||
libm::sinhf(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn sqrt(x: f64) -> f64 { | ||
libm::sqrt(x) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn sqrtf(x: f32) -> f32 { | ||
libm::sqrtf(x) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn tan(n: f64) -> f64 { | ||
libm::tan(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn tanf(n: f32) -> f32 { | ||
libm::tanf(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn tanh(n: f64) -> f64 { | ||
libm::tanh(n) | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn tanhf(n: f32) -> f32 { | ||
libm::tanhf(n) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a check here if x and z are approximately the same instead of always returning
Ok(())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea