Skip to content

Commit

Permalink
Add note to as_f32 documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrubeck committed Apr 6, 2024
1 parent 3641f59 commit 8eb3455
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib.rs
Expand Up @@ -1189,6 +1189,9 @@ impl NotNan<f64> {
/// Converts this [`NotNan`]`<`[`f64`]`>` to a [`NotNan`]`<`[`f32`]`>` while giving up on
/// precision, [using `roundTiesToEven` as rounding mode, yielding `Infinity` on
/// overflow](https://doc.rust-lang.org/reference/expressions/operator-expr.html#semantics).
///
/// Note: For the reverse conversion (from `NotNan<f32>` to `NotNan<f64>`), you can use
/// `.into()`.
pub fn as_f32(self) -> NotNan<f32> {
// This is not destroying invariants, as it is a pure rounding operation. The only two special
// cases are where f32 would be overflowing, then the operation yields Infinity, or where
Expand Down

0 comments on commit 8eb3455

Please sign in to comment.