eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Infinity':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: Infinity


Inheritance:

   Object
   |
   +--Magnitude
      |
      +--ArithmeticValue
         |
         +--Number
            |
            +--MetaNumber
               |
               +--Infinity
                  |
                  +--Infinity::NegativeInfinity
                  |
                  +--Infinity::PositiveInfinity

Package:
stx:libbasic
Category:
Magnitude-Numbers
Version:
rev: 1.20 date: 2017/06/21 12:13:50
user: cg
file: Infinity.st directory: libbasic
module: stx stc-classLibrary: libbasic

Description:


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 protocol:

class initialization
o  initialize
initialize my two singleton instances
usage example(s):
     Infinity initialize

instance creation
o  negative
Return the unique instance of negative infinity

o  negative: aBoolean
Return either instance of negative infinity

o  new
only my two singleton instances are allowed;
get either via Infinity positive or Infinity negative

o  positive
Return the unique instance of positive infinity

queries
o  isAbstract


Instance protocol:

arithmetic
o  * aNumber
Multiply the receiver by the argument and answer with the result.

o  + aNumber
Add the receiver and the argument and answer with the result.

o  - aNumber
Subtract aNumber from the receiver and answer the result.

o  / aNumber
Divide the receiver by the argument and answer the result.

coercing
o  generality
Infinities are more general than scalars, but not more general than
vectors (e.g. Points)

comparing
o  < 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     

o  = aNumber
return true, if the argument represents the same numeric value
as the receiver, false otherwise.

o  > 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
o  differenceFromSomeNumber: aNumber
Sent from aNumber-self, if aNumber does not know how to handle this

o  equalFromSomeNumber: aNumber
Sent from aNumber = self, if aNumber does not know how to handle this.
Return true if aNumber = self.

o  lessFromSomeNumber: aNumber
Sent from aNumber < self, if aNumber does not know how to handle this.
Return true if aNumber < self.

o  productFromSomeNumber: aNumber
Sent from aNumber*self, if aNumber does not know how to handle this

o  quotientFromSomeNumber: aNumber
Return the quotient of the argument, aNumber and the receiver.
Sent when aNumber does not know how to divide by the receiver.

o  sumFromSomeNumber: aNumber
Sent from aNumber+self, if aNumber does not know how to handle this

errors
o  errorUndefinedResult: messageName

testing
o  isFinite

o  isInfinite


Private classes:

    NegativeInfinity
    PositiveInfinity

Examples:


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

ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Tue, 20 Nov 2018 16:28:07 GMT