Skip to main content

format_real

Function format_real 

Source
pub fn format_real(value: f64) -> String
Expand description

Formats a real number the way igraph does in its text output (igraph_real_snprintf): %g-like, with NaN, Inf and -Inf for the special values.

use igraph::vector::format_real;
assert_eq!(format_real(0.5), "0.5");
assert_eq!(format_real(f64::INFINITY), "Inf");
assert_eq!(format_real(f64::NAN), "NaN");