Testing equality
aNumber = (aNumber + 0 i) will answer false... Testing equality (aNumber + 0 i) = aNumber will answer true... (1 + 0 i) = 1. 1 = (1 + 0 i). This is due to premature test isNumber ifFalse [^false]. Obviously, Complex cannot answer true to isNumber because most senders of this message will trust faithfully isKindOf: Number, and Complex is not in this hierarchy. The test should be some sort of isArithmeticValue ifFalse: [^false] and Complex Quaternion and other arithmetic classes extending numbers should answer true to isArithmeticValue. This is another clue that VW ArithmeticValue superclass of Number make sense. And another clue that Complex (ComplexNumber please) are not much used. |
Hi Nicolas,
I am very happy to see your attention to language (isComplex) and detail(this issue.) on the list. +1 on both issues. It would be good if you could familiarize yourself with Mantis. http://bugs.impara.de/my_view_page.php is a good place to start. Ask for a new account. When you have it bring each of these issues up (seprately with links to the other). This way the issue can be tracked; will have staying power until its resolved; and not be lost in the mail stream. Great bug finding. Yours in service, -- Jerome Peace __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
I suggest that you write SUnit tests to document your intention and
that we can follow what you are doing. > Hi Nicolas, > > I am very happy to see your attention to language > (isComplex) and detail(this issue.) on the list. > > +1 on both issues. > > It would be good if you could familiarize yourself > with Mantis. > > http://bugs.impara.de/my_view_page.php > > is a good place to start. Ask for a new account. > When you have it bring each of these issues up > (seprately with links to the other). > > This way the issue can be tracked; will have staying > power until its resolved; and not be lost in the mail > stream. > > Great bug finding. > > Yours in service, -- Jerome Peace > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > |
In reply to this post by Nicolas Cellier-3
One more evidence of Complex equality problem. (Am i sole user of Complex in the world ?). try: 1 i = nil. I am joining a SUnit test (already existed, it is a enhanced version). I am joining what i think a good patch. I use #isNumberExtension testing implemented in Object Number and Complex. (this would extend naturally to quaternions, octonions, ...) This will replace the isNumber test in Number subclass >> = (needed against the 1 = (1 + 0 i) bug) Since the bug is already published on mantis how do i let them know about this fix ? ComplexEqualPatch.1.cs (2K) Download Attachment ComplexEqualTest.3.cs (892 bytes) Download Attachment |
In reply to this post by Nicolas Cellier-3
http://bugs.impara.de/view.php?id=2688
On Wed, 2006-02-08 at 00:19 +0100, nicolas cellier wrote: > Testing equality > aNumber = (aNumber + 0 i) > will answer false... > > Testing equality > (aNumber + 0 i) = aNumber > will answer true... > > (1 + 0 i) = 1. > 1 = (1 + 0 i). > > This is due to premature test > isNumber ifFalse [^false]. > > Obviously, Complex cannot answer true to isNumber because most senders of this > message will trust faithfully isKindOf: Number, and Complex is not in this > hierarchy. > > The test should be some sort of > isArithmeticValue ifFalse: [^false] > and Complex Quaternion and other arithmetic classes extending numbers should > answer true to isArithmeticValue. > > This is another clue that VW ArithmeticValue superclass of Number make sense. > And another clue that Complex (ComplexNumber please) are not much used. > > > signature.asc (196 bytes) Download Attachment |
Free forum by Nabble | Edit this page |