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 {
835
835
fn fract ( self ) -> Self {
836
836
self - libm:: truncf ( self )
837
837
}
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
+ }
838
854
}
839
855
840
856
impl FloatCore for f64 {
@@ -927,6 +943,22 @@ impl FloatCore for f64 {
927
943
fn fract ( self ) -> Self {
928
944
self - libm:: trunc ( self )
929
945
}
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
+ }
930
962
}
931
963
932
964
// FIXME: these doctests aren't actually helpful, because they're using and
You can’t perform that action at this time.
0 commit comments