|
|
@ -56,16 +56,11 @@ For numeric casts, there are quite a few cases to consider:
|
|
|
|
value cannot be represented by the target integer type][float-int]**.
|
|
|
|
value cannot be represented by the target integer type][float-int]**.
|
|
|
|
This includes Inf and NaN. This is a bug and will be fixed.
|
|
|
|
This includes Inf and NaN. This is a bug and will be fixed.
|
|
|
|
* casting from an integer to float will produce the floating point
|
|
|
|
* casting from an integer to float will produce the floating point
|
|
|
|
representation of the integer, rounded if necessary (rounding strategy
|
|
|
|
representation of the integer, rounded if necessary (rounding to
|
|
|
|
unspecified)
|
|
|
|
nearest, ties to even)
|
|
|
|
* casting from an f32 to an f64 is perfect and lossless
|
|
|
|
* casting from an f32 to an f64 is perfect and lossless
|
|
|
|
* casting from an f64 to an f32 will produce the closest possible value
|
|
|
|
* casting from an f64 to an f32 will produce the closest possible value
|
|
|
|
(rounding strategy unspecified)
|
|
|
|
(rounding to nearest, ties to even)
|
|
|
|
* **[NOTE: currently this will cause Undefined Behavior if the value
|
|
|
|
|
|
|
|
is finite but larger or smaller than the largest or smallest finite
|
|
|
|
|
|
|
|
value representable by f32][float-float]**. This is a bug and will
|
|
|
|
|
|
|
|
be fixed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[float-int]: https://github.com/rust-lang/rust/issues/10184
|
|
|
|
[float-int]: https://github.com/rust-lang/rust/issues/10184
|
|
|
|
[float-float]: https://github.com/rust-lang/rust/issues/15536
|
|
|
|
|
|
|
|