[cfp-interest 3737] trunc in Annex F
Jim Thomas
jaswthomas at sbcglobal.net
Sun Nov 23 15:34:11 PST 2025
This follows up on
> Jim & group: Review trunc and canonicalize in Damian's Annex F update to come.
For trunc consider:
F.10.7.9 #1
The trunc functions perform ISO/IEC 60559 “toward zero” rounding, choosing only from among integer values of the type.
...
Normally rounding chooses from among all numbers of the type. The suggested wording borrows from ISO/IEC 60559 which says "the rounding chooses only from among those floating-point numbers of integral values in the format."
The “(regardless of the current rounding direction mode)” isn’t needed because three lines down is "The returned value is exact and is independent of the current rounding direction mode.”
I think putting “toward zero” in quotes is more in line with C editorial practice than italicizing it, for example, as with the “invalid” floating-point exception.
In 7.12.10 the ceil and floor functions are specified as computing the mathematical ceil and floor operations.The round, roundeven, and trunc functions are specified as roundings. (This has historical roots and I’m not suggesting a change.)
In Annex F these functions are further specified to provide ISO/IEC 60559’s five roundToIntegralxxx operations (see C2Y Table F.2) corresponding to the five rounding directions. This suggests that the specifications (except for the example and references thereto) for these functions in F.10.7 be similar to each other. The form could be
F.10.7.n #1
The xxx functions perform ISO/IEC 60559 “rrr” rounding, choosing only from among integer values of the type.
— xxx(+/-0) returns +/-0.
— xxx(+/-inf) returns +/-inf.
The returned value is exact and is independent of the current rounding direction mode.
- Jim Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20251123/2005c1c4/attachment.htm>
More information about the cfp-interest
mailing list