Skip to content

Commit a39c00f

Browse files
Account for removal of UB in float-to-int casts
This updates the reference per PR rust-lang/rust#71269.
1 parent 892b928 commit a39c00f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/expressions/operator-expr.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,8 @@ same trait object.
366366
* zero-extend if the source is unsigned
367367
* sign-extend if the source is signed
368368
* Casting from a float to an integer will round the float towards zero
369-
* **[NOTE: currently this will cause Undefined Behavior if the rounded
370-
value cannot be represented by the target integer type][float-int]**.
371-
This includes Inf and NaN. This is a bug and will be fixed.
369+
* `NaN` will return `0` and values outside the integer range will
370+
saturate to the integer minimum/maximum.
372371
* Casting from an integer to float will produce the closest possible float \*
373372
* if necessary, rounding is according to `roundTiesToEven` mode \*\*\*
374373
* on overflow, infinity (of the same sign as the input) is produced

0 commit comments

Comments
 (0)