You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For integral operands, the \tcode{/} operator yields the algebraic quotient with
any fractional part discarded;
\begin{footnote} This is often called truncation towards zero.
\end{footnote}
The "towards zero" part appears to be redundant
Here are some variants of the description of truncation, one can encounter on the internet:
In simplest terms, truncation means to chop off the decimal portion of a number
truncation is limiting the number of digits right of the decimal point
To truncate a number, we miss off digits past a certain point in the number, filling-in zeros if necessary
They were picked exactly because they are different: one strictly happens to the entire fractional part, the second one happens somewhere in the fractional part, and the third one happens anywhere. Thus they allow production of different results, but what is still common in all of them is the act of replacing a part of the numeral notation (say, decimal notation) of a number with zero digits. The altered part is potentially infinitely long, but that does not even matter here: replacing a single non-zero digit with a zero brings a number closer to zero.
Besides being redundant, "towards zero" here subtly suggests that it is a choice, there are truncation operations that behave otherwise. This does not seem to be the case.
"often" may not be true
If we accept that the number of hits in internet search engines do represent the frequency of usage of an expression to some extent, a couple hundred thousands hits for "truncation towards zero" does not feel "often" when compared to 100+ million hits discussing number truncation, presumably also bringing their result closer to zero.
This is only a guess, but it seems like the footnote may have talked about rounding at some point in the past, and then truncation got thrown in. Because rounding really offers choices, when to round "up" or "down", like the error-minimizing "half" roundings, round() functions usually implement the "half-up" flavour, but there are many more, then one can decide to round always towards positive infinity (ceil()), always towards negative infinity (floor()), and it is also possible to apply ceil() or floor() only to the magnitude of the number, where the latter one is indeed often called rounding towards zero, or truncation.
However, if "truncation towards zero" should be the correct expression, please consider adding where it comes from, because in 2024 it is not obvious.
The text was updated successfully, but these errors were encountered:
Footnote at
draft/source/expressions.tex
Line 6233 in 70b99af
Here are some variants of the description of truncation, one can encounter on the internet:
They were picked exactly because they are different: one strictly happens to the entire fractional part, the second one happens somewhere in the fractional part, and the third one happens anywhere. Thus they allow production of different results, but what is still common in all of them is the act of replacing a part of the numeral notation (say, decimal notation) of a number with zero digits. The altered part is potentially infinitely long, but that does not even matter here: replacing a single non-zero digit with a zero brings a number closer to zero.
Besides being redundant, "towards zero" here subtly suggests that it is a choice, there are truncation operations that behave otherwise. This does not seem to be the case.
If we accept that the number of hits in internet search engines do represent the frequency of usage of an expression to some extent, a couple hundred thousands hits for "truncation towards zero" does not feel "often" when compared to 100+ million hits discussing number truncation, presumably also bringing their result closer to zero.
This is only a guess, but it seems like the footnote may have talked about rounding at some point in the past, and then truncation got thrown in. Because rounding really offers choices, when to round "up" or "down", like the error-minimizing "half" roundings, round() functions usually implement the "half-up" flavour, but there are many more, then one can decide to round always towards positive infinity (ceil()), always towards negative infinity (floor()), and it is also possible to apply ceil() or floor() only to the magnitude of the number, where the latter one is indeed often called rounding towards zero, or truncation.
However, if "truncation towards zero" should be the correct expression, please consider adding where it comes from, because in 2024 it is not obvious.
The text was updated successfully, but these errors were encountered: