-
Notifications
You must be signed in to change notification settings - Fork 97
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
port newlib's hypotf #137
Comments
I'd be interested in taking this up. I haven't contributed to a Rust repo before, so I'd need a bit of help with structure, but this shouldn't be too hard 🤞 |
For instance, there are two functions, |
Looks like those are defined in fdlibm.h They seem to be converting f32 to u32 and back via union type punning (don't compile that code in C++ mode!) In Rust you'd use f32::to_bits and f32::from_bits instead. |
|
Converting between |
So, the issue mentions moving the previous implementation to a private module. Could you point me to where I would put that? Is it in the same file, or some other part of the structure? Just an example file that has done this already would be fine, so that I can look at how they did it. |
I don't see a location where a private module has been setup like that before, but I think I can describe the steps to do what @japaric was thinking:
// Test that the old code continues to build
#[cfg(test)]
#[allow(dead_code)]
mod musl {
mod hypotf;
} |
Source: https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=blob;f=newlib/libm/mathfp/ef_hypot.c;hb=HEAD
Rationale: the current implementation makes use of
f64
and it has bad performance on architectures that have no hardware support for double precision floats.What needs to be done:
math::musl
module and make sure we continue compiling it.tests/newlib.rs
and removing the function name fromtests/musl.rs
.The text was updated successfully, but these errors were encountered: