|
Class: Infinity
Object
|
+--Magnitude
|
+--ArithmeticValue
|
+--Number
|
+--MetaNumber
|
+--Infinity
|
+--Infinity::NegativeInfinity
|
+--Infinity::PositiveInfinity
- Package:
- stx:libbasic
- Category:
- Magnitude-Numbers
- Version:
- rev:
1.21
date: 2019/05/28 03:56:40
- user: cg
- file: Infinity.st directory: libbasic
- module: stx stc-classLibrary: libbasic
I have two instances representing positive and negative infinity.
Claus: fixed some minor bugs (args to errorUndefinedResult:) and some wrong comments.
Changed retry:coercing: to match ST/X's way of doing this
Instance Variables :-
class initialization
-
initialize
-
initialize my two singleton instances
usage example(s):
instance creation
-
negative
-
Return the unique instance of negative infinity
-
negative: aBoolean
-
Return either instance of negative infinity
-
new
-
only my two singleton instances are allowed;
get either via Infinity positive or Infinity negative
-
positive
-
Return the unique instance of positive infinity
queries
-
isAbstract
-
arithmetic
-
* aNumber
-
Multiply the receiver by the argument and answer with the result.
-
+ aNumber
-
Add the receiver and the argument and answer with the result.
-
- aNumber
-
Subtract aNumber from the receiver and answer the result.
-
/ aNumber
-
Divide the receiver by the argument and answer the result.
coercing
-
generality
-
Infinities are more general than scalars, but not more general than
vectors (e.g. Points)
comparing
-
< aNumber
-
Positive infinity is greater than any number other than positive infinity.
Analogously, negative infinity is less than any other number other
than negative infinity
usage example(s):
Infinity positive < 0
Infinity positive < 1000
Infinity positive < -1000
Infinity positive < Infinity positive
Infinity positive < Infinity negative
0 < Infinity positive
1000 < Infinity positive
-1000 < Infinity positive
Infinity negative < Infinity positive
Infinity negative < 0
Infinity negative < 1000
Infinity negative < -1000
Infinity negative < Infinity negative
Infinity negative < Infinity positive
0 < Infinity negative
1000 < Infinity negative
-1000 < Infinity negative
Infinity negative < Infinity positive
|
-
= aNumber
-
return true, if the argument represents the same numeric value
as the receiver, false otherwise.
-
> aNumber
-
Positive infinity is greater than any number other than positive infinity.
Analogously, negative infinity is less than any other number other
than negative infinity
usage example(s):
Infinity positive > 0
Infinity positive > 1000
Infinity positive > -1000
Infinity positive > Infinity positive
Infinity positive > Infinity negative
0 > Infinity positive
1000 > Infinity positive
-1000 > Infinity positive
Infinity negative > Infinity positive
Infinity negative > 0
Infinity negative > 1000
Infinity negative > -1000
Infinity negative > Infinity negative
Infinity negative > Infinity positive
0 > Infinity negative
1000 > Infinity negative
-1000 > Infinity negative
Infinity negative > Infinity positive
|
double dispatching
-
differenceFromSomeNumber: aNumber
-
Sent from aNumber-self, if aNumber does not know how to handle this
-
equalFromSomeNumber: aNumber
-
Sent from aNumber = self, if aNumber does not know how to handle this.
Return true if aNumber = self.
-
lessFromSomeNumber: aNumber
-
Sent from aNumber < self, if aNumber does not know how to handle this.
Return true if aNumber < self.
-
productFromSomeNumber: aNumber
-
Sent from aNumber*self, if aNumber does not know how to handle this
-
quotientFromSomeNumber: aNumber
-
Return the quotient of the argument, aNumber and the receiver.
Sent when aNumber does not know how to divide by the receiver.
-
sumFromSomeNumber: aNumber
-
Sent from aNumber+self, if aNumber does not know how to handle this
errors
-
errorUndefinedResult: messageName
-
testing
-
isFinite
-
-
isInfinite
-
NegativeInfinity
PositiveInfinity
1 + Infinity positive
Infinity positive + 1
Infinity positive + Infinity positive
Infinity negative - 1
Infinity negative + Infinity negative
Infinity negative + Infinity negative
Infinity negative negated
Infinity positive negated
Infinity positive > Infinity negative
Infinity negative > Infinity positive
Infinity negative + Infinity positive -> raises an error
Infinity negative - Infinity negative -> raises an error
|