Skip to content

Commit dd435dc

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 1b8ab72 commit dd435dc

File tree

13 files changed

+1736
-892
lines changed

13 files changed

+1736
-892
lines changed

library/core/Cargo.toml

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

0 commit comments

Comments
 (0)