Crates.io | nostdhf |
lib.rs | nostdhf |
version | 0.1.1 |
source | src |
created_at | 2021-01-29 10:03:56.701583 |
updated_at | 2021-01-29 13:54:33.545184 |
description | Polyfills the missing methods on f32 and f64 in no_std environments |
homepage | |
repository | https://github.com/longfangsong/nostdhf |
max_upload_size | |
id | 347961 |
size | 37,164 |
I really want to do some floating point arithmetic on my embedded controller, which do has an FPU,
but it seems rust still doesn't provide f32 and f64 methods in no_std
now.
Some alternative is using libraries like micromath,
but micromath is just a software floating point library.
Even if we do have an FPU which supports copysign
with commands like fsgnj
on riscv,
and we can use intrinsics::copysignf64
, micromath does not use it.
So I wrote this, to make our life easier when doing floating point arithmetic on embedded systems, and use hardware floating point if possible.
Basically, this will use unsafe functions in intrinsics
to implement the floating point operations, which just as the std library does,
and export F32Ext
and F64Ext
traits.