Skip to content

Commit

Permalink
Account for removal of UB in float-to-int casts
Browse files Browse the repository at this point in the history
This updates the reference per PR rust-lang/rust#71269.
  • Loading branch information
Mark-Simulacrum committed May 12, 2020
1 parent 892b928 commit a39c00f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/expressions/operator-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,8 @@ same trait object.
* zero-extend if the source is unsigned
* sign-extend if the source is signed
* Casting from a float to an integer will round the float towards zero
* **[NOTE: currently this will cause Undefined Behavior if the rounded
value cannot be represented by the target integer type][float-int]**.
This includes Inf and NaN. This is a bug and will be fixed.
* `NaN` will return `0` and values outside the integer range will
saturate to the integer minimum/maximum.
* Casting from an integer to float will produce the closest possible float \*
* if necessary, rounding is according to `roundTiesToEven` mode \*\*\*
* on overflow, infinity (of the same sign as the input) is produced
Expand Down

0 comments on commit a39c00f

Please sign in to comment.