SomeNumber.st
changeset 21212 66b6079fccba
parent 16664 9874b60d44e2
child 21249 86c01ee5a76e
child 24700 c7fd1dbb2f56
equal deleted inserted replaced
21211:ed5fd0f7a98b 21212:66b6079fccba
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 "{ Package: 'stx:libbasic' }"
    12 "{ Package: 'stx:libbasic' }"
       
    13 
       
    14 "{ NameSpace: Smalltalk }"
    13 
    15 
    14 MetaNumber subclass:#SomeNumber
    16 MetaNumber subclass:#SomeNumber
    15 	instanceVariableNames:'realNumber'
    17 	instanceVariableNames:'realNumber'
    16 	classVariableNames:''
    18 	classVariableNames:''
    17 	poolDictionaries:''
    19 	poolDictionaries:''
    84 = something
    86 = something
    85     "return true, if the argument represents the same numeric value
    87     "return true, if the argument represents the same numeric value
    86      as the receiver, false otherwise."
    88      as the receiver, false otherwise."
    87 
    89 
    88     ^ something equalFromSomeNumber:self
    90     ^ something equalFromSomeNumber:self
       
    91 
       
    92     "
       
    93         Float infinity = Infinity positive
       
    94         Infinity positive = Float infinity 
       
    95         Float negativeInfinity = Infinity negative
       
    96         Infinity negative = Float negativeInfinity 
       
    97         Float negativeInfinity = Infinity positive
       
    98         Infinity positive = Float negativeInfinity 
       
    99     "
    89 ! !
   100 ! !
    90 
   101 
    91 !SomeNumber methodsFor:'printing'!
   102 !SomeNumber methodsFor:'printing'!
    92 
   103 
    93 printOn:aStream
   104 printOn:aStream
   104     realNumber := something.
   115     realNumber := something.
   105 ! !
   116 ! !
   106 
   117 
   107 !SomeNumber methodsFor:'queries'!
   118 !SomeNumber methodsFor:'queries'!
   108 
   119 
       
   120 isInfinite
       
   121     ^ realNumber isInfinite
       
   122 !
       
   123 
   109 sign
   124 sign
   110     "return the sign of the receiver (-1, 0 or 1)"
   125     "return the sign of the receiver (-1, 0 or 1)"
   111 
   126 
   112     ^ realNumber sign
   127     ^ realNumber sign
   113 ! !
   128 ! !
   114 
   129 
   115 !SomeNumber class methodsFor:'documentation'!
   130 !SomeNumber class methodsFor:'documentation'!
   116 
   131 
   117 version
   132 version
   118     ^ '$Header: /cvs/stx/stx/libbasic/SomeNumber.st,v 1.4 2014-06-30 14:27:34 stefan Exp $'
   133     ^ '$Header$'
   119 ! !
   134 ! !
   120 
   135