76 self error:'Floats/Doubles cannot be created with new:' |
76 self error:'Floats/Doubles cannot be created with new:' |
77 ! ! |
77 ! ! |
78 |
78 |
79 !LimitedPrecisionReal class methodsFor:'constants & defaults'! |
79 !LimitedPrecisionReal class methodsFor:'constants & defaults'! |
80 |
80 |
|
81 decimalPrecision |
|
82 "return the precision (the number of decimal digits)" |
|
83 |
|
84 ^ (self precision / (10.0 log:self radix)) floor |
|
85 |
|
86 " |
|
87 Float decimalPrecision |
|
88 ShortFloat decimalPrecision |
|
89 " |
|
90 ! |
|
91 |
81 e |
92 e |
82 "return the closest approximation of the irrational number e" |
93 "return the closest approximation of the irrational number e" |
83 |
94 |
84 self subclassResponsibility |
95 self subclassResponsibility |
85 |
96 |
103 ! |
114 ! |
104 |
115 |
105 epsilon |
116 epsilon |
106 "return the maximum relative spacing" |
117 "return the maximum relative spacing" |
107 |
118 |
108 ^ self radix raisedTo:(1- self precision) |
119 ^ self radix asFloat raisedTo:(1 - self precision) |
|
120 |
|
121 " |
|
122 ShortFloat epsilon |
|
123 Float epsilon |
|
124 LongFloat epsilon |
|
125 " |
|
126 |
109 |
127 |
110 "Created: / 7.9.2001 / 14:06:41 / cg" |
128 "Created: / 7.9.2001 / 14:06:41 / cg" |
111 ! |
129 ! |
112 |
130 |
113 fmax |
131 fmax |
114 "return the largest value allowed" |
132 "return the largest value allowed" |
115 |
133 |
116 self subclassResponsibility |
134 self subclassResponsibility |
117 |
135 |
118 "Created: / 7.9.2001 / 14:06:56 / cg" |
136 "Created: / 7.9.2001 / 14:06:56 / cg" |
119 "Modified: / 7.9.2001 / 14:07:15 / cg" |
|
120 ! |
137 ! |
121 |
138 |
122 fmin |
139 fmin |
123 "return the minimum value allowed" |
140 "return the minimum value allowed" |
124 |
141 |
125 self subclassResponsibility |
142 self subclassResponsibility |
126 |
143 |
127 "Created: / 7.9.2001 / 14:07:06 / cg" |
144 "Created: / 7.9.2001 / 14:07:06 / cg" |
128 "Modified: / 7.9.2001 / 14:07:19 / cg" |
|
129 ! |
145 ! |
130 |
146 |
131 pi |
147 pi |
132 "return the closest approximation of the irrational number e" |
148 "return the closest approximation of the irrational number e" |
133 |
149 |
134 self subclassResponsibility |
150 self subclassResponsibility |
135 |
151 |
136 "Modified: / 7.9.2001 / 14:05:02 / cg" |
|
137 "Created: / 7.9.2001 / 14:07:35 / cg" |
152 "Created: / 7.9.2001 / 14:07:35 / cg" |
138 ! |
153 ! |
139 |
154 |
140 precision |
155 precision |
141 "return the precision (the number of radix digits)" |
156 "return the precision (the number of radix digits)" |
142 |
157 |
143 self subclassResponsibility |
158 self subclassResponsibility |
144 |
159 |
145 "Modified: / 7.9.2001 / 14:05:02 / cg" |
|
146 "Created: / 7.9.2001 / 14:07:58 / cg" |
160 "Created: / 7.9.2001 / 14:07:58 / cg" |
147 ! |
161 ! |
148 |
162 |
149 radix |
163 radix |
150 "return the radix (base)" |
164 "return the radix (base)" |
151 |
165 |
152 self subclassResponsibility |
166 self subclassResponsibility |
153 |
167 |
154 "Modified: / 7.9.2001 / 14:05:02 / cg" |
|
155 "Created: / 7.9.2001 / 14:08:20 / cg" |
168 "Created: / 7.9.2001 / 14:08:20 / cg" |
156 ! ! |
169 ! ! |
157 |
170 |
158 !LimitedPrecisionReal methodsFor:'accessing'! |
171 !LimitedPrecisionReal methodsFor:'accessing'! |
159 |
172 |