File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ pub trait Float:
5151 + for < ' a > std:: iter:: Sum < & ' a Self >
5252 + Sealed {
5353 const MIN : Self ;
54+ const MIN_POSITIVE : Self ;
5455 const MAX : Self ;
5556 const ZERO : Self ;
5657 const ONE : Self ;
@@ -80,6 +81,7 @@ macro_rules! impl_float {
8081 $(
8182 impl Float for $ty {
8283 const MIN : Self = <$ty>:: MIN ;
84+ const MIN_POSITIVE : Self = <$ty>:: MIN_POSITIVE ;
8385 const MAX : Self = <$ty>:: MAX ;
8486 const ZERO : Self = 0.0 ;
8587 const ONE : Self = 1.0 ;
@@ -153,10 +155,10 @@ where
153155 if a == b {
154156 // shortcut, handles infinities
155157 true
156- } else if a == zero || b == zero || ( abs_a + abs_b < Self :: MIN ) {
158+ } else if a == zero || b == zero || ( abs_a + abs_b < Self :: MIN_POSITIVE ) {
157159 // a or b is zero or both are extremely close to it
158160 // relative error is less meaningful here
159- diff < eps * Self :: MIN
161+ diff < eps * Self :: MIN_POSITIVE
160162 } else {
161163 // use relative error
162164 diff / ( abs_a + abs_b) . min ( Self :: MAX ) < eps
You can’t perform that action at this time.
0 commit comments