MCPcopy Index your code
hub / github.com/RustPython/RustPython / gt_int

Function gt_int

crates/common/src/float_ops.rs:53–64  ·  view source on GitHub ↗
(value: f64, other_int: &BigInt)

Source from the content-addressed store, hash-verified

51}
52
53pub 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
66pub const fn div(v1: f64, v2: f64) -> Option<f64> {
67 if v2 != 0.0 { Some(v1 / v2) } else { None }

Callers 1

cmpMethod · 0.85

Calls 2

to_f64Method · 0.80
is_infiniteMethod · 0.45

Tested by

no test coverage detected