-
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
Conversation
libm is port of MUSL's libm to Rust. Use this crate to support basic arithmetic functions.
let z: f64 = y.log(E); | ||
|
||
println!("x = {}, e^x = {}, ln(e^x) = {}", x, y, z); | ||
|
||
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.
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
libm::atan2(a, b) | ||
} | ||
|
||
pub extern "C" fn atan2f(a: f32, b: f32) -> f32 { |
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.
I think #[no_mangle]
is missing here
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.
Yes, I revise the PR
hermit-sys/src/cmath.rs
Outdated
libm::log(x) | ||
} | ||
|
||
pub fn logf(x: f32) -> f32 { |
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.
Is this one intentionally a rust function?
Hermit: Remove floor symbol This symbol should be provided by Hermit. It was introduced in 2019 (rust-lang#65167). Since 2020, Hermit provides these math functions on its own (hermit-os/hermit-rs#37). I think moving this to Hermit was merely an oversight. Related: * hermit-os/kernel#654 * hermit-os/hermit-rs#406 CC: `@stlankes`
Hermit: Remove floor symbol This symbol should be provided by Hermit. It was introduced in 2019 (rust-lang/rust#65167). Since 2020, Hermit provides these math functions on its own (hermit-os/hermit-rs#37). I think moving this to Hermit was merely an oversight. Related: * hermit-os/kernel#654 * hermit-os/hermit-rs#406 CC: `@stlankes`
libm is port of MUSL's libm to Rust. This crate is used to support basic arithmetic functions.