Skip to content

Commit d914189

Browse files
committed
Add IEEE 754 TiesToAway rounding mode
This adds IEEE 754 TiesToAway rounding mode, which rounds away from zero in case of a tie.
1 parent 01357a0 commit d914189

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/util/ieee_float.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,19 @@ class ieee_floatt
117117
public:
118118
// ROUND_TO_EVEN is also known as "round to nearest, ties to even", and
119119
// is the IEEE default.
120+
// ROUND_TO_AWAY is also known as "round to infinity".
120121
// The numbering below is what x86 uses in the control word and
121-
// what is recommended in C11 5.2.4.2.2
122+
// what is recommended in C11 5.2.4.2.2.
123+
// The numbering of ROUND_TO_AWAY is not specified in C11 5.2.4.2.2.
122124
enum rounding_modet
123125
{
124-
ROUND_TO_EVEN=0, ROUND_TO_MINUS_INF=1,
125-
ROUND_TO_PLUS_INF=2, ROUND_TO_ZERO=3,
126-
UNKNOWN, NONDETERMINISTIC
126+
ROUND_TO_EVEN = 0,
127+
ROUND_TO_MINUS_INF = 1,
128+
ROUND_TO_PLUS_INF = 2,
129+
ROUND_TO_ZERO = 3,
130+
ROUND_TO_AWAY = 4,
131+
UNKNOWN,
132+
NONDETERMINISTIC
127133
};
128134

129135
// A helper to turn a rounding mode into a constant bitvector expression

0 commit comments

Comments
 (0)