Skip to main content

coerce_real_value

Function coerce_real_value 

Source
pub(crate) fn coerce_real_value<T>(value: f64) -> Result<T, SexpError>
where f64: TryCoerce<T>, <f64 as TryCoerce<T>>::Error: Display,
Expand description

coerce_value for a double, with R’s NA kept apart from NaN.

An integer target refuses NA_real_ as a NaN; R tells the two apart (is.nan(NA_real_) is FALSE), so the refusal says NA is not allowed, as it does for NA_integer_ and a logical NA. A float target keeps NA_real_ (as a NaN), so nothing changes for it.