Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003725 [Squeak] Kernel minor always 05-26-06 17:55 07-15-06 12:06
Reporter DF View Status public  
Assigned To
Priority normal Resolution duplicate  
Status closed   Product Version 3.9
Summary 0003725: [FIX] ComplexTest>>testEquality
Description The change set included with this bug report fixes ComplexTest>>testEquality

Note that the proposed changes need further discussion.
The changes adds #isNumber to Complex, to respond true (this is needed for: 1 = (1 + 0i) ).
And in #= anObject sends #adaptToComplex:andSend: only if anObject is a number (this is needed for: (1 + 0i) = nil).

Problems:
- In the previous version: (1 + 0i) = (Array with: (1 + 0i)) is true because #= in complex sends #adaptToComplex:andSend: to any object that is not a Complex (but this fails with other classes because #adaptToComplex:andSend: is not implemented in Object).
I think that Collection>>adaptToComplex:andSend: should not exists.

- After applying the change set Complex>>isNumber returns true but Complex is not in the hierarchy of Number. I think that a Complex is a Number, so it must be in the Number hierarchy. Maybe Number asumes that numbers are comparable (<,>) and Complex cannot be compared, in that case should be another super class... something like ArithmeticValue or ArithmeticObject
Additional Information
Attached Files  Complex.1.cs [^] (463 bytes) 05-26-06 17:55

- Relationships

SYSTEM WARNING: Creating default object from empty value

SYSTEM WARNING: Creating default object from empty value

SYSTEM WARNING: Creating default object from empty value

SYSTEM WARNING: Creating default object from empty value

SYSTEM WARNING: Creating default object from empty value

SYSTEM WARNING: Creating default object from empty value

related to 0002688new  aNumber = (aNumber + 0 i) answer false 
related to 0002689new  isComplex method name is bad 
related to 0003540closed  ComplexTest>>testEquality errored in 3.9 7025 ; fix attached 
related to 0004262closed KenCausey SUnit test ComplexTest>>testEquality fails for an collection 
related to 0004261closed  SUnit test ComplexTest>>testEquality fails for nil 
related to 0003311new  Complex Numbers are Wacky 

- Notes
(0005139 - 654 - 732 - 1110 - 1110 - 1110 - 1110)
nicolas cellier
05-31-06 00:05
edited on: 05-31-06 00:07

Hi

Yes Complex is a Number, but see all senders of #isNumber and you will see that this might potentially break a lot of code.

In this case, we would need to replace #isNumber with more specialized #isRealNumber...

Note that #isComplexNumber is better than #isComplex that is also implemented elsewhere ( see http://bugs.impara.de/view.php?id=2689 [^] ).

I proposed another fix for complex equality bug at http://bugs.impara.de/view.php?id=2688 [^]
I proposed using #isNumberExtension, which can be true for Number, Complex, Quaternion... But i was not particularily proud of the name.

You can also browse http://bugs.impara.de/view.php?id=3540 [^]

 
(0005140 - 482 - 518 - 770 - 770 - 770 - 770)
nicolas cellier
05-31-06 00:15

Also note that Number equality testing does suffer from other problems ( see http://bugs.impara.de/view.php?id=3374 [^] ), for which i also proposed some fix. Yet i did not merge with complex equality fixes.

See also http://bugs.impara.de/view.php?id=3360 [^]

I did not catch Array equality problem, but yes, Array can implement #adaptToComplex:andSend: if we want to do array arithmetic...

Why would we do array arithmetic with real numbers and wouldn't we with complex numbers ?
 
(0005932 - 9 - 9 - 9 - 9 - 9 - 9)
MarcusDenker
07-15-06 12:06

duplicate
 

- Issue History
Date Modified Username Field Change
05-26-06 17:55 DF New Issue
05-26-06 17:55 DF File Added: Complex.1.cs
05-26-06 18:04 DF Issue Monitored: DF
05-31-06 00:05 nicolas cellier Note Added: 0005139
05-31-06 00:07 nicolas cellier Note Edited: 0005139
05-31-06 00:15 nicolas cellier Note Added: 0005140
07-15-06 11:53 MarcusDenker Relationship added related to 0002688
07-15-06 11:54 MarcusDenker Relationship added related to 0002689
07-15-06 11:54 MarcusDenker Relationship added related to 0003540
07-15-06 11:55 MarcusDenker Relationship added related to 0004262
07-15-06 11:56 MarcusDenker Relationship added related to 0004261
07-15-06 11:57 MarcusDenker Relationship added related to 0003311
07-15-06 12:06 MarcusDenker Status new => closed
07-15-06 12:06 MarcusDenker Note Added: 0005932
07-15-06 12:06 MarcusDenker Resolution open => duplicate


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