Skip to content

Commit 449e016

Browse files
committed
mention that float-to-int casts round towards zero
1 parent af10c3a commit 449e016

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

text/0000-float-semantics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ The [platform support page](https://doc.rust-lang.org/rustc/platform-support.htm
5050

5151
This RFC specifies the behavior of `+`, `-` (unary and binary), `*`, `/`, `%`, `abs`, `copysign`, `mul_add`, `sqrt`, `as`-casts that involve floating-point types, and all comparison operations on floating-point types.
5252
Here, "floating-point types" are `f32` and `f64` and all similar types that might be added in the future such as `f16`, `f128`.
53-
Except for the cases handled below, these operations produce results that exactly match IEEE 754-2008 (with roundTiesToEven and default exception handling, without abruptUnderflow/flush-to-zero).
53+
Except for the cases handled below, these operations produce results that exactly match IEEE 754-2008 (with roundTiesToEven [except for float-to-int casts, which round towards zero] and default exception handling without traps, without abruptUnderflow/flush-to-zero).
5454
`%` matches the behavior of `fmod` in C (this operation is not in the IEEE spec).
5555
When a floating-point value is just passed around (i.e., outside the operations above or any library-provided float operation), its representation bits do *not* change.
5656

0 commit comments

Comments
 (0)