artichoke_backend::convert

Function float_to_int

Source
pub fn float_to_int(float: f64) -> Result<i64, Error>
Expand description

Convert a f64 to an i64 by rounding toward zero.

ยงErrors

This function can return either a FloatDomainError or a RangeError.

FloatDomainError is returned if the input is either NaN or infinite.

RangeError is returned if the input is finite but out of range of i64::MIN..=i64::MAX.