[Cuis-dev] Documentation for the different kinds of divisions
Andres Valloud
ten at smallinteger.com
Mon May 25 07:29:38 PDT 2020
Hi,
On 5/24/20 23:20, Nicolas Cellier via Cuis-dev wrote:
>
>
> Le lun. 25 mai 2020 à 07:55, Andres Valloud via Cuis-dev
> <cuis-dev at lists.cuis.st <mailto:cuis-dev at lists.cuis.st>> a écrit :
>
> Why would you want to add division with floating point properties to
> the
> integers? The reference you mention,
>
> https://www.cplusplus.com/reference/cmath/remainder/
>
> does not mention the integers, and instead seems entirely concerned
> with
> floating point arithmetic (where, presumably, a division with floating
> point properties would be relevant). Surely we already have (several
> flavors of) exact quotients for the integers. Is there a reason why
> this has been pending since 2015?
>
>
> Waouh, very negative reaction!
No, you brought this up to my attention, and this is news to me. From
the information I was provided, I have questions. I haven't formed an
opinion yet, literally because I have not heard any answers to the
questions. No information, no opinion :).
> ratio: and residue: perfectly works with Integer/Fraction
> receiver/arguments as we would expect: they delivered a "centered"
> modulo and rounded quotient and don't mess with Float at all.
Ok --- just keep in mind, I did not question this.
> In addition, ratio: and residue: do the correct thing they should when
> invoked with Float.
Ok --- note, I did not question this either.
> Why is it still pending?
> Because no one cares of floating point standards in the Smalltalk community?
Well, come on, who's being negative now?... I didn't say a word about
that. In fact, I asked you questions because I was interested --- look
at the reaction I got :).
I'd say that sometimes it's very tough to get some traction on these
things. I suppose in part it's because of the difference in perspective
between (for lack of better terms) numerical analysts for which an
intimate understanding of IEEE-754 is required and taken for granted,
and people who develop applications that happen to use floating point
numbers pragmatically in ways such that e.g. 17 / 20 = 0.85 is useful.
It's going to be very difficult to get some common ground between these
two very different perspectives. And it doesn't even matter who's right
and who's wrong. I'd venture it's not even clear there is an absolute
right or wrong, either.
Nevertheless, with these questions that I asked, I am trying to find
some common ground. Let me rephrase the questions, as I think there are
still things to consider.
I can see that ratio: / residue: could make sense in the integers. What
I am asking is whether there is motivation other than "it makes sense"
to add such a division there. Or, put in a different way, what do you
see is the use case of replicating the floating point division rounding
behavior in the integers? That is, why would you add that
functionality? You must have had some utility in mind, and you thought
about this code much longer than I did. So, what did you see?
Andres.
More information about the Cuis-dev
mailing list