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

Function lt_int

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

Source from the content-addressed store, hash-verified

38}
39
40pub fn lt_int(value: f64, other_int: &BigInt) -> bool {
41 match (value.to_bigint(), other_int.to_f64()) {
42 (Some(self_int), Some(other_float)) => value < other_float || self_int < *other_int,
43 // finite float, other_int too big for float,
44 // the result depends only on other_int’s sign
45 (Some(_), None) => other_int.is_positive(),
46 // infinite float must be bigger or lower than any int, depending on its sign
47 _ if value.is_infinite() => value.is_sign_negative(),
48 // NaN, always false
49 _ => false,
50 }
51}
52
53pub fn gt_int(value: f64, other_int: &BigInt) -> bool {
54 match (value.to_bigint(), other_int.to_f64()) {

Callers 1

cmpMethod · 0.85

Calls 2

to_f64Method · 0.80
is_infiniteMethod · 0.45

Tested by

no test coverage detected