Skip to content

Commit 9e800ad

Browse files
author
Robin Kruppe
authored
Update description of float casts
rust-lang/rust#15536 has been closed, there's no UB there, so let's stop linking to it. And for the same reasons (LLVM's assumption of the default floating point environment), f64->f32 and int->float casts do actually have a defined rounding mode, ties-to-even.
1 parent f6ede52 commit 9e800ad

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/casts.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,11 @@ For numeric casts, there are quite a few cases to consider:
5656
value cannot be represented by the target integer type][float-int]**.
5757
This includes Inf and NaN. This is a bug and will be fixed.
5858
* casting from an integer to float will produce the floating point
59-
representation of the integer, rounded if necessary (rounding strategy
60-
unspecified)
59+
representation of the integer, rounded if necessary (rounding to
60+
nearest, ties to even)
6161
* casting from an f32 to an f64 is perfect and lossless
6262
* casting from an f64 to an f32 will produce the closest possible value
63-
(rounding strategy unspecified)
64-
* **[NOTE: currently this will cause Undefined Behavior if the value
65-
is finite but larger or smaller than the largest or smallest finite
66-
value representable by f32][float-float]**. This is a bug and will
67-
be fixed.
63+
(rounding to nearest, ties to even)
6864

6965

7066
[float-int]: https://github.com/rust-lang/rust/issues/10184
71-
[float-float]: https://github.com/rust-lang/rust/issues/15536

0 commit comments

Comments
 (0)