fn get_nan<T>(x: T) -> T {
T::NAN
}
This does not works, how can I do it?
fn get_nan<T>(x: T) -> T {
T::NAN
}
This does not works, how can I do it?
There's no built-in way. You can use num_traits::Float::nan()
, if you really need to be generic, or just fix the type as either f32
or f64
.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.