This repository was archived by the owner on Apr 28, 2025. It is now read-only.
File tree 2 files changed +10
-4
lines changed
crates/compiler-builtins-smoke-test/src
2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,8 @@ no_mangle! {
67
67
cbrtf( x: f32 ) -> f32 ;
68
68
ceil( x: f64 ) -> f64 ;
69
69
ceilf( x: f32 ) -> f32 ;
70
+ ceilf128( x: f128) -> f128;
71
+ ceilf16( x: f16) -> f16;
70
72
copysign( x: f64 , y: f64 ) -> f64 ;
71
73
copysignf( x: f32 , y: f32 ) -> f32 ;
72
74
copysignf128( x: f128, y: f128) -> f128;
Original file line number Diff line number Diff line change @@ -31,24 +31,28 @@ pub fn ceil<F: Float>(x: F) -> F {
31
31
32
32
// Otherwise, raise an inexact exception.
33
33
force_eval ! ( x + F :: MAX ) ;
34
+
34
35
if x. is_sign_positive ( ) {
35
36
ix += m;
36
37
}
38
+
37
39
ix &= !m;
40
+ F :: from_bits ( ix)
38
41
} else {
39
42
// |x| < 1.0, raise an inexact exception since truncation will happen (unless x == 0).
40
43
force_eval ! ( x + F :: MAX ) ;
41
44
42
45
if x. is_sign_negative ( ) {
43
46
// -1.0 < x <= -0.0; rounding up goes toward -0.0.
44
- return F :: NEG_ZERO ;
47
+ F :: NEG_ZERO
45
48
} else if ix << 1 != zero {
46
49
// 0.0 < x < 1.0; rounding up goes toward +1.0.
47
- return F :: ONE ;
50
+ F :: ONE
51
+ } else {
52
+ // +0.0 remains unchanged
53
+ x
48
54
}
49
55
}
50
-
51
- F :: from_bits ( ix)
52
56
}
53
57
54
58
#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments