The `round-away` procedure in this SRFI corresponds to the `round`
procedure in C99: https://cppreference.com/c/numeric/math/round
Meanwhile, the standard `round` procedure corresponds to the `roundeven`
procedure in C23: https://port70.net/~nsz/c/c23/n3220.html#7.12.9.8
which breaks ties by rounding to even.
The purpose of adding round-away is to have conversion-to-integer
procedures that align with the functions of other languages. Although
one could implement other tie-breaking modes, I don't know of any
languages that do that.
IEEE 754-2019 standard includes procedures that are equivalent to
Scheme's truncate, floor, ceiling, round and this SRFI's round-even.
(IEEE 754 also has a "round according to current rounding mode"
procedure, which isn't applicable here.) The relevant section is copied
below:
___________________________________________
5.9 Details of operations to round a floating-point datum to integral value
Several operations round a floating-point number to an integral-valued
floating-point number in the same format.
The rounding is analogous to that specified in Clause 4, but the
rounding chooses only from among those floating-point numbers of
integral values in the format. [...]
― sourceFormat roundToIntegralTiesToEven(source)
roundToIntegralTiesToEven(x) rounds x to the nearest integral value,
with halfway cases rounding to even.
― sourceFormat roundToIntegralTowardZero(source)
roundToIntegralTowardZero(x) rounds x to an integral value toward zero.
― sourceFormat roundToIntegralTowardPositive(source)
roundToIntegralTowardPositive(x) rounds x to an integral value toward
positive infinity.
― sourceFormat roundToIntegralTowardNegative(source)
roundToIntegralTowardNegative(x) rounds x to an integral value toward
negative infinity.
― sourceFormat roundToIntegralTiesToAway(source)
roundToIntegralTiesToAway(x) rounds x to the nearest integral value,
with halfway cases rounding away from zero.