Re: Add bcdivmod() to BCMath
---- On Tue, 25 Jun 2024 17:29:58 +0100 Saki Takamachi wrote ---
>
> Also, it is not practical to record the remainder in the Number object resulting from the
> division. This is because there can be objects whose division results are equal but whose remainders
> are different.
>
> In the discussion of the Number class, it was argued that objects should not have too much
> state.
>
> Increasing the state of surplus is not desirable in this respect, as it contradicts the
> previous argument.
If anything I was thinking of recording the remainder in the the original number object, not the one
returned (or possibly in something like a WeakMap keyed to it). So it does increase state and makes
it technically no longer immutable, but that change in state would not be detectable from outside
except by profiling performance. It's state that would have to be ignored in the equality
check.
Thread (11 messages)