Transcendental Numbers

Bruce Cohen cohenb at gemstone.com
Wed Feb 4 20:05:17 UTC 1998


sqrmax at cvtci.com.ar says:
>> It wouldn't be nice to put CayleyNumber as subclass of Number. Even the 
>> class Complex doesn't fit nicely under Number, because of the #> and #< that 
>> also troubles Point's implementation under Number or something alike. Another 
>> number set that doesn't fit under Number is the ModInteger number set. And ok, 
>> they are all numbers of this kind or the other, but they won't multiply 
>> between themselves in all cases. What's the sense of multiplying a modInteger by 
>> aFloat? So it looks as if there are a lot of numbers (another one: Gauss' 
>> integers) that don't fit as a subclass of Number. Maybe Number isn't what it's 
>> named after.

Agreed, especially the last part.  A really general numeric hierarchy
couldn't be based on Number as it is now implemented; there have been a
couple of designs mentioned in this thread that use a root class called
something like ArithmeticObject, which makes a lot of sense to me.
The paper that Ralph Johnson mentioned has a rather appealing hierarchy
that ought to take quaternions and such fairly easily.

>> I agree with this... although I still don't like the picture. I feel Number 
>> as too big for what it is. Look at Number's subclasses. There are Integers, 
>> Floats, and Fractions. All particular subsets of the rationals, which are 
>> commutative. But Numbers are not only rationals.

And Floats aren't Reals either; there's no representation for Real under
Number, which I consider a problem.  We have arbitrary precision
integers, so arbitrary precision floats seem reasonable (modulo all the
nasty details of implementation, of course!).  In general, I favor
replacing the numeric hierarchy as given in Smalltalk-80.  I'm going to
look at Ralph's double-dispatch code as soon as I get some free time
(currently scheduled for April :-( )
-----------------------------------------------------------------------------
"Those of us who have been trained as architects have this desire
perhaps at the very center of our lives: that one day, somewhere,
sonehow, we shall build one building which is wonderful, beautiful,
breathtaking, a place where people can walk and dream for centuries."
    -- Christopher Alexander, "the Timeless Way of Building"
-----------------------------------------------------------------------------
Bruce Cohen,                               |  email: cohenb at gemstone.com
GemStone Systems, Inc.                     |  phone: (503)533-3602
20575 NW Von Neumann Drive                 |  fax:   (503)629-8556
Beaverton, OR USA 97006                    |  web:   http://www.gemstone.com





More information about the Squeak-dev mailing list