Function ironcalc_base::number_format::to_excel_precision_str
source · pub fn to_excel_precision_str(value: f64) -> StringExpand description
It rounds a f64 with p significant figures:
use ironcalc_base::number_format;
assert_eq!(number_format::to_precision(0.1+0.2, 15), 0.3);
assert_eq!(number_format::to_excel_precision_str(0.1+0.2), "0.3");This intends to be equivalent to the js: ${parseFloat(value.toPrecision(precision)})
See (ecma).
FIXME: There has to be a better algorithm :/