Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006874 [Squeak] Kernel minor always 01-26-08 00:54 04-18-10 22:05
Reporter nicolas cellier View Status public  
Assigned To nicolas cellier
Priority normal Resolution fixed  
Status closed   Product Version 3.10
Summary 0006874: digitLogic:op:len: is not correct
Description (2 raisedTo: 31) negated bitAnd: (2 raisedTo: 31) negated - 1
does answer
    0
it should answer
    (2 raisedTo: 32) negated

This bug caused 0006873
Additional Information In two complement (assume an infinite sequence of 1 on the left)

... 11111111 10000000 00000000 00000000 00000000
... 11111111 01111111 11111111 11111111 11111111
=>
... 11111111 00000000 00000000 00000000 00000000

Algorithm works well, but on every 8bit boundary, where a carry rz=true is not correctly taken into account.
Attached Files  TwoComplementDigitLogic-Test-M6874-nice.1.cs [^] (1,734 bytes) 01-26-08 01:40
 TwoComplementDigitLogic-Patch-M6874-nice.1.cs [^] (2,356 bytes) 01-26-08 01:40

- Relationships
related to 0006873closed andreas [BUG] isPowerOfTwo incorrect for some LargeNegativeInteger 

- Notes
(0011713 - 195 - 249 - 249 - 249 - 249 - 249)
nicolas cellier
01-26-08 01:43

"fix begin"
Installer mantis bug: 6874 fix:'TwoComplementDigitLogic-Patch-M6874-nice.1.cs'.
"fix test"
Installer mantis bug: 6874 fix:'TwoComplementDigitLogic-Test-M6874-nice.1.cs'.
"fix end"
 
(0011714 - 415 - 609 - 609 - 609 - 609 - 609)
nicolas cellier
01-26-08 01:52

Solution in patch.1 rely on digitAt: behaving correctly past digitLength...
It does loop until carry vanishes.
Maybe there is a simpler solution than processing this carry:
Keep original 1 to: len do: loop and add this a posteriori test:

    (rneg and: [result normalize isZero]) ifTrue: [
        result := result growby: 1.
        result digitAt: result digitLength put: 1.
    ].
    ^result normalize
 
(0013277 - 59 - 59 - 209 - 209 - 209 - 209)
nicolas cellier
08-24-09 20:14

Fixed in http://source.squeak.org/trunk/Kernel-nice.199.mcz [^]
 

- Issue History
Date Modified Username Field Change
01-26-08 00:54 nicolas cellier New Issue
01-26-08 01:40 nicolas cellier File Added: TwoComplementDigitLogic-Test-M6874-nice.1.cs
01-26-08 01:40 nicolas cellier File Added: TwoComplementDigitLogic-Patch-M6874-nice.1.cs
01-26-08 01:43 nicolas cellier Note Added: 0011713
01-26-08 01:52 nicolas cellier Note Added: 0011714
01-10-09 02:00 Keith_Hodges Status new => pending
08-24-09 20:14 nicolas cellier Note Added: 0013277
10-03-09 20:10 nicolas cellier Relationship added related to 0006873
10-03-09 20:10 nicolas cellier Status pending => resolved
10-03-09 20:10 nicolas cellier Fixed in Version  => trunk
10-03-09 20:10 nicolas cellier Resolution open => fixed
10-03-09 20:10 nicolas cellier Assigned To  => nicolas cellier
04-18-10 22:05 andreas Status resolved => closed


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
56 total queries executed.
38 unique queries executed.
Powered by Mantis Bugtracker