home *** CD-ROM | disk | FTP | other *** search
- " A bounded number is a number that can get bigger and smaller, "
- " but only within some bounds (that may be infinite). If you add "
- " to it, for instance, and it gets too big, it won't grow any "
- " larger than the upper bound "
- "
- *
- * boundedNum.self,v 1.3 1993/05/30 21:41:14 richards Exp
- *
- * boundedNum.self,v
- * Revision 1.3 1993/05/30 21:41:14 richards
- * CVS checkin.
- *
- * Revision 1.2 1993/05/14 22:42:25 richards
- * Bounded numbers now work properly in 2.0.1 and even print nicely.
- * +/- and * are supported operations that return a *new* bnum.
- *
- * Revision 1.1 1992/10/05 06:37:47 richards
- * Initial revision
- *
- *
- *
- "
-
- aa traits _AddSlotsIfAbsent: ( | bnum = (). |)
-
- aa traits bnum _Define: ( |
- parent* = traits clonable.
- printString = (
- 'Bnum<', (lower printString), '|', (upper printString), '>: ', (value printString)
- ).
- + aNumericThing = ( copy value: (aNumericThing + value) ).
- - aNumericThing = ( copy value: (aNumericThing - value) ).
- * aNumericThing = ( copy value: (aNumericThing * value) ).
- value = ( val ).
- value: x = ( | newval. |
- newval: x max: lower.
- newval: newval min: upper.
- val: newval ).
- |)
-
- aa prototypes _AddSlotsIfAbsent: ( | bnum = (). |)
-
- aa prototypes bnum _Define: ( |
- parent* = aa traits bnum.
- thisObjectPrints = true.
- upper <- infinity.
- lower <- 0-infinity.
- val <- 0.
- |)
-
-