Skip to content

Commit a666d85

Browse files
committed
README: note that this crate is on crates.io and already usable
1 parent 7275814 commit a666d85

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,30 @@ term goal is to enable [math support in the `core` crate][core].
1414
[pr]: https://github.com/rust-lang-nursery/compiler-builtins/pull/248
1515
[core]: https://github.com/japaric/libm/milestone/2
1616

17+
## Already usable
18+
19+
This crate is [on crates.io] and can be used today in stable `#![no_std]` programs like this:
20+
21+
[on crates.io]: https://crates.io/crates/libm
22+
23+
``` rust
24+
#![no_std]
25+
26+
extern crate libm;
27+
28+
use libm::F32Ext; // adds methods to `f32`
29+
30+
fn foo(x: f32) {
31+
let y = x.sqrt();
32+
let z = libm::truncf(x);
33+
}
34+
```
35+
36+
Not all the math functions are available at the moment. Check the [API docs] to learn what's
37+
currently supported.
38+
39+
[API docs]: https://docs.rs/libm
40+
1741
## Contributing
1842

1943
Please check [CONTRIBUTING.md](CONTRIBUTING.md)

0 commit comments

Comments
 (0)