• Home
  • Raw
  • Download

Lines Matching +full:rust +full:- +full:src

3 - Pick your favorite math function from the [issue tracker].
4 - Look for the C implementation of the function in the [MUSL source code][src].
5 - Copy paste the C code into a Rust file in the `src/math` directory and adjust
6 `src/math/mod.rs` accordingly. Also, uncomment the corresponding trait method
7 in `src/lib.rs`.
8 - Write some simple tests in your module (using `#[test]`)
9 - Run `cargo test` to make sure it works
10 - Run `cargo test --features musl-reference-tests` to compare your
12 - Send us a pull request! Make sure to run `cargo fmt` on your code before
15 - :tada:
17 [issue tracker]: https://github.com/rust-lang/libm/issues
18 [src]: https://git.musl-libc.org/cgit/musl/tree/src/math
19 [`src/math/truncf.rs`]: https://github.com/rust-lang/libm/blob/master/src/math/truncf.rs
23 [PR #65]: https://github.com/rust-lang/libm/pull/65
27 - *IMPORTANT* The code in this crate will end up being used in the `core` crate so it can **not**
30 - Only use relative imports within the `math` directory / module, e.g. `use self::fabs::fabs` or
33 - To reinterpret a float as an integer use the `to_bits` method. The MUSL code uses the
36 - To reinterpret an integer as a float use the `f32::from_bits` constructor. The MUSL code uses the
39 - You may use other methods from core like `f64::is_nan`, etc. as appropriate.
41 - If you're implementing one of the private double-underscore functions, take a look at the
46 - You may encounter weird literals like `0x1p127f` in the MUSL code. These are hexadecimal floating
47 point literals. Rust (the language) doesn't support these kind of literals. The best way I have
53 ``` rust
69 ``` rust
74 - Rust code panics on arithmetic overflows when not optimized. You may need to use the [`Wrapping`]
77 [`Wrapping`]: https://doc.rust-lang.org/std/num/struct.Wrapping.html
91 cargo test --features musl-reference-tests
94 Note that you may need to pass `--release` to Cargo if there are errors related