7439
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2003 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
"{ Package: 'stx:libbasic' }"
|
|
13 |
|
21212
|
14 |
"{ NameSpace: Smalltalk }"
|
|
15 |
|
7439
|
16 |
MetaNumber subclass:#SomeNumber
|
|
17 |
instanceVariableNames:'realNumber'
|
|
18 |
classVariableNames:''
|
|
19 |
poolDictionaries:''
|
|
20 |
category:'Magnitude-Numbers'
|
|
21 |
!
|
|
22 |
|
|
23 |
!SomeNumber class methodsFor:'documentation'!
|
|
24 |
|
|
25 |
copyright
|
|
26 |
"
|
|
27 |
COPYRIGHT (c) 2003 by eXept Software AG
|
|
28 |
All Rights Reserved
|
|
29 |
|
|
30 |
This software is furnished under a license and may be used
|
|
31 |
only in accordance with the terms of that license and with the
|
|
32 |
inclusion of the above copyright notice. This software may not
|
|
33 |
be provided or otherwise made available to, or used by, any
|
|
34 |
other person. No title to or ownership of the software is
|
|
35 |
hereby transferred.
|
|
36 |
"
|
|
37 |
!
|
|
38 |
|
|
39 |
documentation
|
|
40 |
"
|
7470
|
41 |
Only used internally during double dispatch,
|
|
42 |
when MetaNumbers (INF and NAN) are involved.
|
7439
|
43 |
|
|
44 |
[author:]
|
|
45 |
Claus Gittinger
|
|
46 |
|
|
47 |
[see also:]
|
|
48 |
Number Infinity NotANumber
|
|
49 |
Float ShortFloat Fraction FixedPoint Integer Complex
|
|
50 |
FloatArray DoubleArray
|
|
51 |
"
|
|
52 |
! !
|
|
53 |
|
|
54 |
!SomeNumber methodsFor:'arithmetic'!
|
|
55 |
|
|
56 |
* something
|
|
57 |
"return the product of the receiver and the argument"
|
|
58 |
|
|
59 |
^ something productFromSomeNumber:self
|
|
60 |
!
|
|
61 |
|
|
62 |
+ something
|
|
63 |
"return the sum of the receiver and the argument"
|
|
64 |
|
|
65 |
^ something sumFromSomeNumber:self
|
|
66 |
!
|
|
67 |
|
|
68 |
- something
|
|
69 |
"return the difference of the receiver and the argument"
|
|
70 |
|
|
71 |
^ something differenceFromSomeNumber:self
|
|
72 |
!
|
|
73 |
|
|
74 |
/ something
|
|
75 |
"return the quotient of the receiver and the argument"
|
|
76 |
|
|
77 |
^ something quotientFromSomeNumber:self
|
|
78 |
!
|
|
79 |
|
|
80 |
< something
|
|
81 |
"return true if the receiver is less than the argument"
|
|
82 |
|
|
83 |
^ something lessFromSomeNumber:self
|
|
84 |
!
|
|
85 |
|
|
86 |
= something
|
7471
|
87 |
"return true, if the argument represents the same numeric value
|
|
88 |
as the receiver, false otherwise."
|
7439
|
89 |
|
|
90 |
^ something equalFromSomeNumber:self
|
21212
|
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 |
"
|
7439
|
100 |
! !
|
|
101 |
|
16664
|
102 |
!SomeNumber methodsFor:'printing'!
|
|
103 |
|
|
104 |
printOn:aStream
|
|
105 |
realNumber printOn:aStream.
|
|
106 |
! !
|
|
107 |
|
7471
|
108 |
!SomeNumber methodsFor:'private-accessing'!
|
|
109 |
|
|
110 |
realNumber
|
|
111 |
^ realNumber
|
|
112 |
!
|
|
113 |
|
|
114 |
realNumber:something
|
|
115 |
realNumber := something.
|
|
116 |
! !
|
|
117 |
|
7439
|
118 |
!SomeNumber methodsFor:'queries'!
|
|
119 |
|
21212
|
120 |
isInfinite
|
|
121 |
^ realNumber isInfinite
|
|
122 |
!
|
|
123 |
|
7439
|
124 |
sign
|
7471
|
125 |
"return the sign of the receiver (-1, 0 or 1)"
|
|
126 |
|
7439
|
127 |
^ realNumber sign
|
|
128 |
! !
|
|
129 |
|
|
130 |
!SomeNumber class methodsFor:'documentation'!
|
|
131 |
|
|
132 |
version
|
21212
|
133 |
^ '$Header$'
|
7439
|
134 |
! !
|
16664
|
135 |
|