[Cuis-dev] LargeNegativeInteger --- extra minus signs when printing
Andres Valloud
ten at smallinteger.com
Tue Sep 14 18:07:16 PDT 2021
Hi, consider this test case.
| ws |
ws := String new writeStream.
1 bitShift: 64 :: negated :: printOn: ws base: 10 nDigits: 20.
ws contents '-1844674407-3709551616'
The problem is that printOn:base:nDigits: is not reimplemented in
LargeNegativeInteger. See attached for a suggested fix.
Andres.
-------------- next part --------------
'From Cuis 5.0 [latest update: #4860] on 14 September 2021 at 6:04:45 pm'!
!LargeNegativeInteger methodsFor: 'printing' stamp: 'sqr 9/14/2021 18:04:00'!
printOn: aStream base: b nDigits: n
"Append a representation of this number in base b on aStream using n digits.
In order to reduce cost of LargePositiveInteger ops, split the number of digts approximatily in two
Should be invoked with: 0 <= self < (b raisedToInteger: n)"
aStream nextPut: $-.
self abs printOn: aStream base: b nDigits: n! !
More information about the Cuis-dev
mailing list