[squeak-dev] What should Integer>>digitCompare: return?

Chris Cunningham cunningham.cb at gmail.com
Sun Oct 28 22:48:58 UTC 2018


(keyboard failure)
On Sun, Oct 28, 2018 at 3:41 PM Chris Cunningham <cunningham.cb at gmail.com>
wrote:

> Looking at LargeIntegers (I'm 64 bit, so these are big):
> {
> 1152921504606846977 digitCompare:  -1152921504606846977.
> 1152921504606846977 digitCompare:  -1152921504606846978.
> 1152921504606846978 digitCompare:  -1152921504606846977.
> }  "#(0 -1 1)"
>
> {
> 1249 digitCompare: -1249.
> 1249 digitCompare: -1250.
> 1250 digitCompare: -1249
>
 }   "#(1 1 1)"

The method is actively different for SmallIntegers and LargeIntegers.

I'm not sure how much this matters - besides the fact that it is lying
around waiting for someone to use it.  For comparisons of integers, the
callers check to see if one (or more) of the numbers are negative, then
handles the issues here.

It is also currently used in DateAndTime class methods (#nowWithOffset:
[deprecated] and #now:offset:), which is probably safe because now is
always after the epoch.  And we hopefully wouldn't use #now:withOffset: for
pre-epoch times.

Is this worth fixing?

-cbc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20181028/f5cb121e/attachment.html>


More information about the Squeak-dev mailing list