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

Function number_to_complex

crates/vm/src/stdlib/_ast.rs:740–746  ·  view source on GitHub ↗
(number: &ast::Number)

Source from the content-addressed store, hash-verified

738
739#[cfg(feature = "parser")]
740fn number_to_complex(number: &ast::Number) -> Option<(f64, f64, bool)> {
741 match number {
742 ast::Number::Complex { real, imag } => Some((*real, *imag, true)),
743 ast::Number::Float(value) => Some((*value, 0.0, false)),
744 ast::Number::Int(value) => value.as_i64().map(|value| (value as f64, 0.0, false)),
745 }
746}
747
748#[cfg(feature = "codegen")]
749pub(crate) fn compile(

Callers 1

fold_number_binopFunction · 0.85

Calls 2

SomeClass · 0.50
mapMethod · 0.45

Tested by

no test coverage detected