7436
|
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 |
"
|
18831
|
12 |
"{ Package: 'stx:libbasic' }"
|
7436
|
13 |
|
18831
|
14 |
"{ NameSpace: Smalltalk }"
|
7436
|
15 |
|
|
16 |
Number subclass:#MetaNumber
|
|
17 |
instanceVariableNames:''
|
|
18 |
classVariableNames:''
|
|
19 |
poolDictionaries:''
|
|
20 |
category:'Magnitude-Numbers'
|
|
21 |
!
|
|
22 |
|
|
23 |
!MetaNumber 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 |
"
|
|
41 |
Common behavior for metaNumbers (INF, NaN).
|
|
42 |
|
|
43 |
[author:]
|
|
44 |
Claus Gittinger
|
|
45 |
|
|
46 |
[see also:]
|
|
47 |
Number Infinity NotANumber
|
|
48 |
Float ShortFloat Fraction FixedPoint Integer Complex
|
|
49 |
FloatArray DoubleArray
|
|
50 |
"
|
|
51 |
! !
|
|
52 |
|
18916
|
53 |
!MetaNumber class methodsFor:'queries'!
|
|
54 |
|
|
55 |
isAbstract
|
|
56 |
^ self == MetaNumber
|
|
57 |
! !
|
|
58 |
|
7436
|
59 |
!MetaNumber methodsFor:'coercing & converting'!
|
|
60 |
|
|
61 |
asFloat
|
|
62 |
^ self class
|
|
63 |
raise:#domainErrorSignal
|
|
64 |
receiver:self
|
|
65 |
selector:#asFloat
|
|
66 |
arguments:#()
|
|
67 |
errorString:'Cannot represent non-finite as float'.
|
|
68 |
!
|
|
69 |
|
|
70 |
asFraction
|
|
71 |
^ self class
|
|
72 |
raise:#domainErrorSignal
|
|
73 |
receiver:self
|
|
74 |
selector:#asFraction
|
|
75 |
arguments:#()
|
|
76 |
errorString:'Cannot represent non-finite as fraction'.
|
|
77 |
!
|
|
78 |
|
|
79 |
asInteger
|
|
80 |
^ self class
|
|
81 |
raise:#domainErrorSignal
|
|
82 |
receiver:self
|
|
83 |
selector:#asInteger
|
|
84 |
arguments:#()
|
|
85 |
errorString:'Cannot represent non-finite as integer'.
|
|
86 |
!
|
|
87 |
|
|
88 |
asLargeFloat
|
|
89 |
^ self class
|
|
90 |
raise:#domainErrorSignal
|
|
91 |
receiver:self
|
|
92 |
selector:#asLargeFloat
|
|
93 |
arguments:#()
|
|
94 |
errorString:'Cannot represent non-finite as float'.
|
|
95 |
!
|
|
96 |
|
|
97 |
asLongFloat
|
|
98 |
^ self class
|
|
99 |
raise:#domainErrorSignal
|
|
100 |
receiver:self
|
|
101 |
selector:#asLongFloat
|
|
102 |
arguments:#()
|
|
103 |
errorString:'Cannot represent non-finite as float'.
|
|
104 |
!
|
|
105 |
|
|
106 |
asShortFloat
|
|
107 |
^ self class
|
|
108 |
raise:#domainErrorSignal
|
|
109 |
receiver:self
|
|
110 |
selector:#asShortFloat
|
|
111 |
arguments:#()
|
|
112 |
errorString:'Cannot represent non-finite as float'.
|
|
113 |
!
|
|
114 |
|
|
115 |
coerce:aNumber
|
18831
|
116 |
"convert the argument aNumber into an instance of the receiver's class and return it."
|
|
117 |
|
7436
|
118 |
^ aNumber asMetaNumber
|
|
119 |
!
|
|
120 |
|
|
121 |
generality
|
|
122 |
"NaN, INF etc. are more general than scalars, but not more general than
|
|
123 |
vectors (e.g. Points)"
|
|
124 |
|
|
125 |
^ 105
|
|
126 |
! !
|
|
127 |
|
|
128 |
!MetaNumber class methodsFor:'documentation'!
|
|
129 |
|
|
130 |
version
|
18831
|
131 |
^ '$Header$'
|
17865
|
132 |
!
|
|
133 |
|
|
134 |
version_SVN
|
17911
|
135 |
^ '$Id: MetaNumber.st 10761 2012-01-19 11:46:00Z vranyj1 $'
|
7436
|
136 |
! !
|
18831
|
137 |
|
17910
|
138 |
|
17911
|
139 |
|