Skip to content

Commit 36790d2

Browse files
committed
Initial implementation of core_float_math
Since [1], `compiler-builtins` makes a certain set of math symbols weakly available on all platforms. This means we can begin exposing some of the related functions in `core`, so begin this process here. It is not possible to provide inherent methods in both `core` and `std` while giving them different stability gates, so standalone functions are added instead. This provides a way to experiment with the functionality while unstable; once it is time to stabilize, they can be converted to inherent. For `f16` and `f128`, everything is unstable so we can move the inherent methods. The following are included to start: * floor * ceil * round * round_ties_even * trunc * fract * mul_add * div_euclid * rem_euclid * powi * sqrt * abs_sub * cbrt These mirror the set of functions that we have in `compiler-builtins` since [1]. Tracking issue: rust-lang#137578 [1]: rust-lang/compiler-builtins#763
1 parent 414482f commit 36790d2

File tree

13 files changed

+1713
-869
lines changed

13 files changed

+1713
-869
lines changed

library/core/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,10 @@ check-cfg = [
3535
# and to stdarch `core_arch` crate which messes-up with Cargo list
3636
# of declared features, we therefor expect any feature cfg
3737
'cfg(feature, values(any()))',
38+
# Internal features aren't marked known config by default, we use these to
39+
# gate tests.
40+
'cfg(target_has_reliable_f16)',
41+
'cfg(target_has_reliable_f16_math)',
42+
'cfg(target_has_reliable_f128)',
43+
'cfg(target_has_reliable_f128_math)',
3844
]

0 commit comments

Comments
 (0)