|
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 |
|
13 "{ Package: 'stx:libbasic' }" |
|
14 |
|
15 Number subclass:#MetaNumber |
|
16 instanceVariableNames:'' |
|
17 classVariableNames:'' |
|
18 poolDictionaries:'' |
|
19 category:'Magnitude-Numbers' |
|
20 ! |
|
21 |
|
22 !MetaNumber class methodsFor:'documentation'! |
|
23 |
|
24 copyright |
|
25 " |
|
26 COPYRIGHT (c) 2003 by eXept Software AG |
|
27 All Rights Reserved |
|
28 |
|
29 This software is furnished under a license and may be used |
|
30 only in accordance with the terms of that license and with the |
|
31 inclusion of the above copyright notice. This software may not |
|
32 be provided or otherwise made available to, or used by, any |
|
33 other person. No title to or ownership of the software is |
|
34 hereby transferred. |
|
35 " |
|
36 ! |
|
37 |
|
38 documentation |
|
39 " |
|
40 Common behavior for metaNumbers (INF, NaN). |
|
41 |
|
42 [author:] |
|
43 Claus Gittinger |
|
44 |
|
45 [see also:] |
|
46 Number Infinity NotANumber |
|
47 Float ShortFloat Fraction FixedPoint Integer Complex |
|
48 FloatArray DoubleArray |
|
49 " |
|
50 ! ! |
|
51 |
|
52 !MetaNumber methodsFor:'coercing & converting'! |
|
53 |
|
54 asFloat |
|
55 ^ self class |
|
56 raise:#domainErrorSignal |
|
57 receiver:self |
|
58 selector:#asFloat |
|
59 arguments:#() |
|
60 errorString:'Cannot represent non-finite as float'. |
|
61 ! |
|
62 |
|
63 asFraction |
|
64 ^ self class |
|
65 raise:#domainErrorSignal |
|
66 receiver:self |
|
67 selector:#asFraction |
|
68 arguments:#() |
|
69 errorString:'Cannot represent non-finite as fraction'. |
|
70 ! |
|
71 |
|
72 asInteger |
|
73 ^ self class |
|
74 raise:#domainErrorSignal |
|
75 receiver:self |
|
76 selector:#asInteger |
|
77 arguments:#() |
|
78 errorString:'Cannot represent non-finite as integer'. |
|
79 ! |
|
80 |
|
81 asLargeFloat |
|
82 ^ self class |
|
83 raise:#domainErrorSignal |
|
84 receiver:self |
|
85 selector:#asLargeFloat |
|
86 arguments:#() |
|
87 errorString:'Cannot represent non-finite as float'. |
|
88 ! |
|
89 |
|
90 asLongFloat |
|
91 ^ self class |
|
92 raise:#domainErrorSignal |
|
93 receiver:self |
|
94 selector:#asLongFloat |
|
95 arguments:#() |
|
96 errorString:'Cannot represent non-finite as float'. |
|
97 ! |
|
98 |
|
99 asShortFloat |
|
100 ^ self class |
|
101 raise:#domainErrorSignal |
|
102 receiver:self |
|
103 selector:#asShortFloat |
|
104 arguments:#() |
|
105 errorString:'Cannot represent non-finite as float'. |
|
106 ! |
|
107 |
|
108 coerce:aNumber |
|
109 ^ aNumber asMetaNumber |
|
110 ! |
|
111 |
|
112 generality |
|
113 "NaN, INF etc. are more general than scalars, but not more general than |
|
114 vectors (e.g. Points)" |
|
115 |
|
116 ^ 105 |
|
117 ! ! |
|
118 |
|
119 !MetaNumber class methodsFor:'documentation'! |
|
120 |
|
121 version |
|
122 ^ '$Header: /cvs/stx/stx/libbasic/MetaNumber.st,v 1.1 2003-06-21 10:12:21 cg Exp $' |
|
123 ! ! |