The f32 and f64 powf methods follow the IEEE 754-2008 recommendations for NaN handling, but these are quite surprising. For example, f64::powf(1.0, f64::NAN) returns 1.0, not f64::NAN. This behavior should be documented.
The current docs don't mention NaN at all, which leads one to assume that any argument being NaN would produce a NaN result, like arithmetic operations. But these are not the standard behavior for powf.
This was mentioned in #60468, which links a playground illustrating the exceptions.
The
f32andf64powfmethods follow the IEEE 754-2008 recommendations for NaN handling, but these are quite surprising. For example,f64::powf(1.0, f64::NAN)returns1.0, notf64::NAN. This behavior should be documented.The current docs don't mention NaN at all, which leads one to assume that any argument being NaN would produce a NaN result, like arithmetic operations. But these are not the standard behavior for
powf.This was mentioned in #60468, which links a playground illustrating the exceptions.