This repository was archived by the owner on Apr 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
crates/compiler-builtins-smoke-test/src Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,8 @@ no_mangle! {
6767 cbrtf( x: f32 ) -> f32 ;
6868 ceil( x: f64 ) -> f64 ;
6969 ceilf( x: f32 ) -> f32 ;
70+ ceilf128( x: f128) -> f128;
71+ ceilf16( x: f16) -> f16;
7072 copysign( x: f64 , y: f64 ) -> f64 ;
7173 copysignf( x: f32 , y: f32 ) -> f32 ;
7274 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 {
3131
3232 // Otherwise, raise an inexact exception.
3333 force_eval ! ( x + F :: MAX ) ;
34+
3435 if x. is_sign_positive ( ) {
3536 ix += m;
3637 }
38+
3739 ix &= !m;
40+ F :: from_bits ( ix)
3841 } else {
3942 // |x| < 1.0, raise an inexact exception since truncation will happen (unless x == 0).
4043 force_eval ! ( x + F :: MAX ) ;
4144
4245 if x. is_sign_negative ( ) {
4346 // -1.0 < x <= -0.0; rounding up goes toward -0.0.
44- return F :: NEG_ZERO ;
47+ F :: NEG_ZERO
4548 } else if ix << 1 != zero {
4649 // 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
4854 }
4955 }
50-
51- F :: from_bits ( ix)
5256}
5357
5458#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments