Skip to main content

canonical_complex

Function canonical_complex 

Source
pub fn canonical_complex(real: f64, imag: f64) -> String
Expand description

Renders (real, imag) parts into the canonical a+bi literal form, fixing the imaginary sign and normalizing negative zero via canonical_f64.

ยงExamples

use sim_lib_numbers_complex::canonical_complex;

assert_eq!(canonical_complex(3.0, 4.0), "3+4i");
assert_eq!(canonical_complex(1.5, -2.25), "1.5-2.25i");