Using floating point methods such as is_nan with #![no_std]

I have seen that floating point methods such as is_nan or is_finite, whose implementation is trivial, are implemented in libcore in the unstable Float trait and exposed in libstd as stable methods. This means that you can’t use these methods with #![no_std]. Is there any reason it is done this way? Why not allow to use these methods without libstd?

I have also seen that to_degrees and to_radians methods in libcore were stabilized in rust 1.11 (according to the release notes). However, it turns out they are in the same situation described before.

Some of that is in num-traits’ new FloatCore:

(Note it was renamed from the initial PR title. Also it’s not published yet, because I’m considering a few additions before we get locked in.)

1 Like