File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -835,6 +835,22 @@ impl FloatCore for f32 {
835835 fn fract ( self ) -> Self {
836836 self - libm:: truncf ( self )
837837 }
838+
839+ #[ cfg( all( not( feature = "std" ) , feature = "libm" ) ) ]
840+ #[ inline]
841+ fn is_sign_negative ( self ) -> bool {
842+ libm:: copysignf ( 1.0f32 , self ) == -1.0f32
843+ }
844+
845+ #[ cfg( all( not( feature = "std" ) , feature = "libm" ) ) ]
846+ #[ inline]
847+ fn signum ( self ) -> Self {
848+ if self . is_nan ( ) {
849+ FloatCore :: nan ( )
850+ } else {
851+ libm:: copysignf ( 1.0f32 , self )
852+ }
853+ }
838854}
839855
840856impl FloatCore for f64 {
@@ -927,6 +943,22 @@ impl FloatCore for f64 {
927943 fn fract ( self ) -> Self {
928944 self - libm:: trunc ( self )
929945 }
946+
947+ #[ cfg( all( not( feature = "std" ) , feature = "libm" ) ) ]
948+ #[ inline]
949+ fn is_sign_negative ( self ) -> bool {
950+ libm:: copysign ( 1.0f64 , self ) == -1.0f64
951+ }
952+
953+ #[ cfg( all( not( feature = "std" ) , feature = "libm" ) ) ]
954+ #[ inline]
955+ fn signum ( self ) -> Self {
956+ if self . is_nan ( ) {
957+ FloatCore :: nan ( )
958+ } else {
959+ libm:: copysign ( 1.0f64 , self )
960+ }
961+ }
930962}
931963
932964// FIXME: these doctests aren't actually helpful, because they're using and
You can’t perform that action at this time.
0 commit comments