Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006873 [Squeak] Kernel minor always 01-25-08 21:44 04-18-10 22:05
Reporter nicolas cellier View Status public  
Assigned To andreas
Priority normal Resolution fixed  
Status closed   Product Version
Summary 0006873: [BUG] isPowerOfTwo incorrect for some LargeNegativeInteger
Description negative SmallInteger are never powers of two. So far, so good.
neither should LargeNegativeInteger be.

Unfortunately some will answer true to isPowerOfTwo, like:

  (31 to: 111 by: 8) allSatisfy: [:n | (2 raisedTo: n) negated isPowerOfTwo]

Just too bad...
One more case of algorithm correct in restricted area but not in general case...
Additional Information
Cure is easy, override isPowerOfTwo in LargeNegativeInteger to simply ^false
Attached Files  isPowerOfTwo-Test-M6873-nice.1.cs [^] (732 bytes) 01-25-08 22:00
 isPowerOfTwo-Patch-M6873-nice.1.cs [^] (588 bytes) 01-25-08 22:00

- Relationships
related to 0006874closed nicolas cellier digitLogic:op:len: is not correct 

- Notes
(0011711 - 173 - 227 - 227 - 227 - 227 - 227)
nicolas cellier
01-25-08 22:05

"fix begin"
Installer mantis bug: 6873 fix:'isPowerOfTwo-Patch-M6873-nice.1.cs'.
"fix test"
Installer mantis bug: 6873 fix:'isPowerOfTwo-Test-M6873-nice.1.cs'.
"fix end"
 
(0011712 - 198 - 234 - 234 - 318 - 318 - 318)
nicolas cellier
01-26-08 00:07
edited on: 01-26-08 01:57

Now i think algorithm was correct.
What is incorrect is #bitAnd: implemented in #digitLogic:op:length:

So my patch is only a workaround against a symptom...
forget the patch and look at 0006874

 
(0011715 - 138 - 192 - 192 - 192 - 192 - 192)
nicolas cellier
01-26-08 01:55

"fix begin"
Installer mantis ensureFix: 6874.
"fix test"
Installer mantis bug: 6873 fix:'isPowerOfTwo-Test-M6873-nice.1.cs'.
"fix end"
 
(0013317 - 39 - 39 - 39 - 123 - 123 - 123)
nicolas cellier
09-19-09 21:10

This has been fixed in trunk with 0006874
 

- Issue History
Date Modified Username Field Change
01-25-08 21:44 nicolas cellier New Issue
01-25-08 22:00 nicolas cellier File Added: isPowerOfTwo-Test-M6873-nice.1.cs
01-25-08 22:00 nicolas cellier File Added: isPowerOfTwo-Patch-M6873-nice.1.cs
01-25-08 22:05 nicolas cellier Note Added: 0011711
01-26-08 00:07 nicolas cellier Note Added: 0011712
01-26-08 01:55 nicolas cellier Note Added: 0011715
01-26-08 01:57 nicolas cellier Note Edited: 0011712
01-10-09 02:00 Keith_Hodges Status new => pending
01-10-09 03:32 Keith_Hodges Status pending => testing
01-10-09 03:39 Keith_Hodges Status testing => resolved
01-10-09 03:39 Keith_Hodges Fixed in Version  => 3.11
01-10-09 03:39 Keith_Hodges Resolution open => fixed
01-10-09 03:39 Keith_Hodges Assigned To  => Keith_Hodges
01-10-09 03:41 Keith_Hodges Status resolved => testing
09-19-09 21:10 nicolas cellier Note Added: 0013317
10-03-09 19:33 Keith_Hodges Status testing => assigned
10-03-09 19:33 Keith_Hodges Assigned To Keith_Hodges => andreas
10-03-09 20:10 nicolas cellier Relationship added related to 0006874
10-03-09 20:11 nicolas cellier Status assigned => resolved
10-03-09 20:11 nicolas cellier Fixed in Version 3.11 => trunk
04-18-10 22:05 andreas Status resolved => closed


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