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

Eliot Miranda eliot.miranda at gmail.com
Mon Oct 29 19:08:02 UTC 2018


Hi Chris,

> On 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)

I do apologize.  You’re quite right; the primitive is broken for SmallInteger.  It should be the case that
(-1 digitCompare: 1) = 0
since ((1 to: 8) collect: [:i| -1 digitAt: i ]) = #(1 0 0 0 0 0 0 0) and: [(1 to: 8) collect: [:i| 1 digitAt: i ]) = #(1 0 0 0 0 0 0 0)]

I’ll fix this ASAP :-)


More information about the Vm-dev mailing list