(value: f64, other_int: &BigInt)
| 51 | } |
| 52 | |
| 53 | pub fn gt_int(value: f64, other_int: &BigInt) -> bool { |
| 54 | match (value.to_bigint(), other_int.to_f64()) { |
| 55 | (Some(self_int), Some(other_float)) => value > other_float || self_int > *other_int, |
| 56 | // finite float, other_int too big for float, |
| 57 | // the result depends only on other_int’s sign |
| 58 | (Some(_), None) => other_int.is_negative(), |
| 59 | // infinite float must be bigger or lower than any int, depending on its sign |
| 60 | _ if value.is_infinite() => value.is_sign_positive(), |
| 61 | // NaN, always false |
| 62 | _ => false, |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | pub const fn div(v1: f64, v2: f64) -> Option<f64> { |
| 67 | if v2 != 0.0 { Some(v1 / v2) } else { None } |
no test coverage detected