From: "Schwab,Wilhelm K" <bschwab@anest.ufl.edu> ... I have not been over all of it, but I have found that Real>>arcCosH and #arcTanH can answer a Complex. I would rather not have to say it, but I do not get the sense that you have taken our concerns seriously. We want the errors from Float when the domains are violated. A mere #asComplex can be dividing line that puts the programmer in conrol.
Thanks. I had not caught these.
On this next minor point I can be talked out of it, but I would much prefer #cosh etc. to #cosH; it's easier to type and matches all conventional notation that I have seen.
I am trying to follow camelCase as I understand it. One rubric from user interfaces is that things which are distinct should *look* distinct. I personally perfer cosH to cosh because I know it is not a typo. That I really mean cosH not cos. Let me know the proper thing to do here.
Number>>angle should probably be called #argument, though I would argue that it should not exist as it is another example of implicit (however benign) coercion to complex numbers.
I am trying to follow conventions here for other languages which support Complex data types [primarily Common Lisp and, Scheme]. An angle in radians is what is returned. Wny not call the function returning an angle to be #angle ? Again, let me know the proper thing to do in Smalltalk.
Complex>>angle looks like it will answer zero for a value of zero?? AFAIK, there should be no direction for a zero vector. In a way, it is splitting hairs because exact comparisons of floats are dubious, but it probably should raise an error for zero.
I am following ANSI X3J13 (they had a formal vote which declared the angle of zero to be zero). Let me know of a better refrerence. [The problem with standards is that there are so many to chose from ;^].
Object Arts has long looked down on #as* and #is* methods. With my bias toward their views confessed, #isComplex and #isNumberOrComplex realy should not exist, and even if they do, what are they doing in Object? #isNumberOrComplex raises concerns that there is too much blending of Complex into floats.
According to my recollection of _Squeak by Example_, #isFoo is a standard ideom for a class #Foo. #isNumberOrComplex is used to make double dispatch work in #=, now that Complex instances answer false to isNumber. Do you have a better solution here? #isNumberOrComplex was added to Object to make the test relatively cheap (#= is used a lot, yes?). If Complex does not interoperate, at least to some extent, with Floats how would it be useful for anything? Smalltalk without polymorphism ??? Better solutions?
There are various uses of Taylor series corrections and some things that are computed directly in terms of exponentials. My hunch is that robust scientific libraries will (hopefully) do these things well, and most of the transcendental functions, especially over complex numbers, should come from them when possible and reasonable. The results will likely be faster and probably more accurate than what we can do in Smalltalk.
I agree that a better global solution for numbers is desired. This is an attempt for a small tweak to simply fix the problems I outlined. These problems exist in the current code base. Thank you again for taking the time to look at this, -KenD