2009/8/13 Igor Stasenko <siguctua@gmail.com>:
2009/8/13 Â <csrabak@bol.com.br>:
For the mathematical part yes. Now, submiting to all the list, I want to propose a modification in the code based on Smalltalk style (the comments w/"csr" are only for my explanation and should not go to the production code!):
< other "Can only compare with pure real or imaginary parts" ((self imaginary = 0) and: [other imaginary = 0]) ifTrue: [^ self real < other real].              "csr: if it's true you
i think, if imaginary part is zero , then Complex values should be normalized back to real ones (obviously to conserve the memory), and therefore the test 'self imaginary = 0' is redundant.
Hi Igor, this is Behavior of Complex package available in VW. However, I wonder how you can conciliate the previous requirement: -2 asComplex sqrt For example, I want this function myFun ^x sqrt arcSin But I know -4 myFun will fail... So, I hear you and write myFun ^x asComplex sqrt arcSin But there, problem, 4 myFun will raise an error, so as 4 asComplex myFun Then, i can write smelling code like this - that's no real fun ;) myFun ^x asComplex sqrt asComplex arcSin unless of course you propose I hide this shit behind some other selectors like: myFun ^x complexSqrt complexArcSin but then I will probably want some other extensions like the quaternionArcSin, the squareMatrixArcSin, etc... so, I don't know if I'm really satisfied with those selectors... Nicolas