author | Claus Gittinger <cg@exept.de> |
Thu, 27 Jun 2019 16:34:40 +0200 | |
changeset 24379 | 852be153b0ec |
parent 24333 | e6d6a165972d |
child 24434 | a99ad18a4ace |
permissions | -rw-r--r-- |
23797 | 1 |
"{ Encoding: utf8 }" |
2 |
||
1 | 3 |
" |
4 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
7220 | 14 |
"{ Package: 'stx:libbasic' }" |
15 |
||
19031 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
23805 | 18 |
UnboxedFloatArray variableDoubleSubclass:#DoubleArray |
1263 | 19 |
instanceVariableNames:'' |
20 |
classVariableNames:'' |
|
21 |
poolDictionaries:'' |
|
22 |
category:'Collections-Arrayed' |
|
1 | 23 |
! |
24 |
||
88 | 25 |
!DoubleArray class methodsFor:'documentation'! |
26 |
||
27 |
copyright |
|
28 |
" |
|
29 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
1 | 30 |
All Rights Reserved |
31 |
||
88 | 32 |
This software is furnished under a license and may be used |
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
1 | 40 |
|
88 | 41 |
documentation |
42 |
" |
|
13825 | 43 |
DoubleArrays store doubleFloat values (and nothing else). |
16639 | 44 |
They have been added to support heavy duty number crunching and |
45 |
data exchange with openGL frameworks and other mass data libraries |
|
46 |
somewhat better than other smalltalks do. |
|
362 | 47 |
Storing Floats & Doubles in these objects (instead of Arrays) |
48 |
has some benefits: |
|
1 | 49 |
|
88 | 50 |
1) since the values are stored directly (instead of pointers to them) |
51 |
both access overhead and garbage collect overhead is minimized. |
|
52 |
||
53 |
2) they can be much faster passed to c functions (such as graphics |
|
54 |
libraries or heavy duty math packages), since the double values |
|
55 |
come packed and can be used in C by using a (double *) or double[]. |
|
362 | 56 |
There is no need to loop over the array extracting doubles. |
88 | 57 |
|
58 |
3) they could (in theory) be much more easily be processed by things like |
|
59 |
vector and array processors |
|
1 | 60 |
|
88 | 61 |
Be aware however, that Float- and DoubleArrays are not supported in other |
62 |
smalltalks - your program will thus become somewhat less portable. |
|
63 |
(since their protocol is the same as normal arrays filled with floats, |
|
64 |
they can of course be easily simulated - a bit slower though) |
|
1 | 65 |
|
2820 | 66 |
However, they could be simulated by a ByteArray, using doubleAt: and |
92 | 67 |
doubleAtPut: messages to access the elements, but that seems a bit |
68 |
clumsy and unelegant. Also, the stc-compiler may learn how to deal |
|
69 |
with Float- and DoubleArrays, making accesses very fast in the future. |
|
2820 | 70 |
Hint: if you use doubleArrays in your application and must port it |
71 |
to some other smalltalk, define a DoubleArray class there, which is derived |
|
72 |
from ByteArray, and add access methods. |
|
1 | 73 |
|
2145 | 74 |
Of course, DoubleArray can be subclassed, |
75 |
and named instance variables can be added there. |
|
1 | 76 |
|
362 | 77 |
See example uses in the GLX interface and GLDemos. |
1263 | 78 |
|
4062 | 79 |
[memory requirements:] |
80 |
OBJ-HEADER + (size * double-size) |
|
81 |
||
1263 | 82 |
[See also:] |
83 |
FloatArray Array |
|
1290 | 84 |
|
85 |
[author:] |
|
86 |
Claus Gittinger |
|
88 | 87 |
" |
627 | 88 |
! ! |
89 |
||
13708
079c1e1c7594
faster elementByteSize query
Claus Gittinger <cg@exept.de>
parents:
7220
diff
changeset
|
90 |
!DoubleArray class methodsFor:'queries'! |
079c1e1c7594
faster elementByteSize query
Claus Gittinger <cg@exept.de>
parents:
7220
diff
changeset
|
91 |
|
079c1e1c7594
faster elementByteSize query
Claus Gittinger <cg@exept.de>
parents:
7220
diff
changeset
|
92 |
elementByteSize |
16850
4011fc651793
comment/format in: #elementByteSize
Claus Gittinger <cg@exept.de>
parents:
16639
diff
changeset
|
93 |
"for bit-like containers, return the number of bytes stored per element. |
4011fc651793
comment/format in: #elementByteSize
Claus Gittinger <cg@exept.de>
parents:
16639
diff
changeset
|
94 |
Here, 8 is returned" |
4011fc651793
comment/format in: #elementByteSize
Claus Gittinger <cg@exept.de>
parents:
16639
diff
changeset
|
95 |
|
13708
079c1e1c7594
faster elementByteSize query
Claus Gittinger <cg@exept.de>
parents:
7220
diff
changeset
|
96 |
^ 8 |
079c1e1c7594
faster elementByteSize query
Claus Gittinger <cg@exept.de>
parents:
7220
diff
changeset
|
97 |
|
079c1e1c7594
faster elementByteSize query
Claus Gittinger <cg@exept.de>
parents:
7220
diff
changeset
|
98 |
"Created: / 15-09-2011 / 14:12:46 / cg" |
079c1e1c7594
faster elementByteSize query
Claus Gittinger <cg@exept.de>
parents:
7220
diff
changeset
|
99 |
! ! |
079c1e1c7594
faster elementByteSize query
Claus Gittinger <cg@exept.de>
parents:
7220
diff
changeset
|
100 |
|
7220 | 101 |
!DoubleArray methodsFor:'queries'! |
102 |
||
103 |
defaultElement |
|
104 |
^ Float zero |
|
20301 | 105 |
! |
106 |
||
107 |
isValidElement:anObject |
|
108 |
"return true, if I can hold this kind of object" |
|
109 |
||
110 |
^ anObject isNumber |
|
20314 | 111 |
! |
112 |
||
113 |
max |
|
114 |
"return the largest element; |
|
115 |
redefined for speed" |
|
116 |
%{ /* NOCONTEXT */ |
|
117 |
if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) { |
|
118 |
INT _sz = __doubleArraySize(self); |
|
119 |
||
120 |
if (_sz > 0) { |
|
121 |
double *_p = __DoubleArrayInstPtr(self)->d_element; |
|
122 |
double _max; |
|
123 |
||
124 |
_max = _p[0]; |
|
125 |
if (_sz > 1) { |
|
126 |
INT _i; |
|
127 |
double _prev, _this; |
|
128 |
||
129 |
/* how about inline-mmx-asm for this ... */ |
|
130 |
_this = _p[1]; |
|
131 |
for (_i=2; _i<_sz; _i++) { |
|
132 |
_prev = _this; |
|
133 |
_this = _p[_i]; |
|
134 |
if (_prev > _max) _max = _prev; |
|
135 |
} |
|
136 |
if (_this > _max) _max = _this; |
|
137 |
} |
|
138 |
RETURN (__MKFLOAT(_max)); |
|
139 |
} |
|
140 |
} |
|
141 |
%}. |
|
142 |
^ super max |
|
143 |
||
144 |
" |
|
145 |
|f1| |
|
146 |
||
147 |
f1 := (1 to:10000) asDoubleArray. |
|
148 |
Time millisecondsToRun:[ 1000 timesRepeat:[ f1 max ] ] |
|
149 |
" |
|
150 |
" |
|
151 |
|a1| |
|
152 |
||
153 |
a1 := (1 to:10000) asArray collect:#asFloat. |
|
154 |
Time millisecondsToRun:[ 1000 timesRepeat:[ a1 max ] ] |
|
155 |
" |
|
156 |
" |
|
157 |
|f1| |
|
158 |
||
159 |
f1 := DoubleArray withAll:#(1 2 3 4 5). |
|
160 |
f1 max |
|
161 |
" |
|
162 |
" |
|
163 |
|f1| |
|
164 |
||
165 |
f1 := DoubleArray withAll:#(5 4 3 2 1). |
|
166 |
f1 max |
|
167 |
" |
|
168 |
! |
|
169 |
||
170 |
min |
|
171 |
"return the smallest element; |
|
172 |
redefined for speed" |
|
173 |
%{ /* NOCONTEXT */ |
|
174 |
if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) { |
|
175 |
INT _sz = __doubleArraySize(self); |
|
176 |
||
177 |
if (_sz > 0) { |
|
178 |
double *_p = __DoubleArrayInstPtr(self)->d_element; |
|
179 |
double _min; |
|
180 |
||
181 |
_min = _p[0]; |
|
182 |
if (_sz > 1) { |
|
183 |
INT _i; |
|
184 |
double _prev, _this; |
|
185 |
||
186 |
/* how about inline-mmx-asm for this ... */ |
|
187 |
_this = _p[1]; |
|
188 |
for (_i=2; _i<_sz; _i++) { |
|
189 |
_prev = _this; |
|
190 |
_this = _p[_i]; |
|
191 |
if (_prev < _min) _min = _prev; |
|
192 |
} |
|
193 |
if (_this < _min) _min = _this; |
|
194 |
} |
|
195 |
RETURN (__MKFLOAT(_min)); |
|
196 |
} |
|
197 |
} |
|
198 |
%}. |
|
199 |
^ super min |
|
200 |
||
201 |
" |
|
202 |
|f1| |
|
203 |
||
204 |
f1 := (1 to:10000) asDoubleArray. |
|
205 |
Time millisecondsToRun:[ 1000 timesRepeat:[ f1 min ] ] |
|
206 |
" |
|
207 |
" |
|
208 |
|a1| |
|
209 |
||
210 |
a1 := (1 to:10000) asArray collect:#asFloat. |
|
211 |
Time millisecondsToRun:[ 1000 timesRepeat:[ a1 min ] ] |
|
212 |
" |
|
213 |
" |
|
214 |
|f1| |
|
215 |
||
216 |
f1 := DoubleArray withAll:#(1 2 3 4 5). |
|
217 |
f1 min |
|
218 |
" |
|
219 |
" |
|
220 |
|f1| |
|
221 |
||
222 |
f1 := DoubleArray withAll:#(5 4 3 2 1). |
|
223 |
f1 min |
|
224 |
" |
|
225 |
! |
|
226 |
||
227 |
minMax |
|
228 |
"return a Tuple holding the smallest and largest element; |
|
229 |
redefined for speed" |
|
230 |
||
231 |
|min max empty| |
|
232 |
||
233 |
%{ |
|
234 |
if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) { |
|
21080 | 235 |
INT _sz = __doubleArraySize(self); |
20314 | 236 |
|
237 |
if (_sz > 0) { |
|
238 |
INT _i; |
|
239 |
double *_p = __DoubleArrayInstPtr(self)->d_element; |
|
240 |
double _min, _max; |
|
241 |
OBJ ret; |
|
242 |
||
243 |
_min = _max = _p[0]; |
|
244 |
for (_i=_sz-1; _i>0; _i-=2) { |
|
245 |
double _v1 = _p[_i]; |
|
246 |
double _v2 = _p[_i-1]; |
|
247 |
if (_v1 < _v2) { |
|
248 |
if (_v1 < _min) _min = _v1; |
|
249 |
if (_v2 > _max) _max = _v2; |
|
250 |
} else { |
|
251 |
if (_v2 < _min) _min = _v2; |
|
252 |
if (_v1 > _max) _max = _v1; |
|
253 |
} |
|
254 |
} |
|
21080 | 255 |
|
20314 | 256 |
min = __MKFLOAT(_min); |
257 |
__PROTECT__(min); |
|
258 |
max = __MKFLOAT(_max); |
|
259 |
__UNPROTECT__(min); |
|
260 |
RETURN (__ARRAY_WITH2(min, max)); |
|
261 |
} |
|
262 |
empty = true; |
|
263 |
} |
|
264 |
%}. |
|
265 |
empty == true ifTrue:[ |
|
266 |
^ self emptyCollectionError. |
|
267 |
]. |
|
268 |
"/ fallback if no primitive code |
|
269 |
^ super minMax |
|
270 |
||
271 |
" |
|
272 |
|f1| |
|
273 |
||
274 |
f1 := (1 to:10000) asDoubleArray. |
|
275 |
Time millisecondsToRun:[ 1000 timesRepeat:[ f1 minMax ] ] |
|
276 |
" |
|
277 |
" |
|
278 |
|f1| |
|
279 |
||
280 |
f1 := (1 to:10000) asDoubleArray. |
|
281 |
Time millisecondsToRun:[ 1000 timesRepeat:[ f1 min ] ] |
|
282 |
" |
|
283 |
" |
|
284 |
|f1| |
|
285 |
||
286 |
f1 := DoubleArray withAll:#(1 2 3 4 5). |
|
287 |
f1 minMax |
|
288 |
" |
|
289 |
" |
|
290 |
|f1| |
|
291 |
||
292 |
f1 := DoubleArray withAll:#(5 4 3 2 1). |
|
293 |
f1 minMax |
|
294 |
" |
|
7220 | 295 |
! ! |
296 |
||
23797 | 297 |
!DoubleArray methodsFor:'testing'! |
298 |
||
299 |
isFloatArray |
|
300 |
"return true if the receiver has float elements. |
|
301 |
These are Float, Double- and HalfFloat arrays" |
|
302 |
||
303 |
^ true |
|
304 |
||
305 |
"Created: / 02-03-2019 / 23:13:34 / Claus Gittinger" |
|
306 |
! ! |
|
307 |
||
19031 | 308 |
!DoubleArray methodsFor:'vector arithmetic'! |
309 |
||
310 |
dot: aFloatVector |
|
311 |
"Return the dot product of the receiver and the argument. |
|
312 |
Raises an error, if the argument is not of the same size as the receiver." |
|
313 |
||
314 |
| mySize result | |
|
315 |
||
316 |
%{ |
|
317 |
if ((__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) |
|
318 |
&& (__ClassInstPtr(__qClass(aFloatVector))->c_ninstvars == __mkSmallInteger(0))) { |
|
319 |
INT __mySize = __doubleArraySize(self); |
|
320 |
double __result = 0.0; |
|
321 |
double *__p1 = __DoubleArrayInstPtr(self)->d_element; |
|
322 |
||
323 |
if (__mySize > 0) { |
|
324 |
if (__isFloats(aFloatVector)) { |
|
325 |
INT __otherSize = __floatArraySize(aFloatVector); |
|
326 |
||
327 |
if (__mySize == __otherSize) { |
|
328 |
float *__p2 = __FloatArrayInstPtr(aFloatVector)->f_element; |
|
329 |
INT __i; |
|
330 |
/* how about inline-mmx-asm for this ... */ |
|
331 |
for (__i=0; __i<__mySize; __i++) { |
|
332 |
__result += (__p1[__i] * __p2[__i]); |
|
333 |
} |
|
334 |
RETURN (__MKFLOAT(__result)); |
|
335 |
} |
|
336 |
} else if (__isDoubles(aFloatVector)) { |
|
337 |
INT __otherSize = __doubleArraySize(aFloatVector); |
|
338 |
||
339 |
if (__mySize == __otherSize) { |
|
340 |
double *__p2 = __DoubleArrayInstPtr(aFloatVector)->d_element; |
|
341 |
INT __i; |
|
342 |
/* how about inline-mmx-asm for this ... */ |
|
343 |
for (__i=0; __i<__mySize; __i++) { |
|
344 |
__result += (__p1[__i] * __p2[__i]); |
|
345 |
} |
|
346 |
RETURN (__MKFLOAT(__result)); |
|
347 |
} |
|
348 |
} |
|
349 |
} |
|
350 |
} |
|
351 |
%}. |
|
352 |
^ super dot:aFloatVector |
|
353 |
||
354 |
" |
|
355 |
|v| |
|
356 |
||
357 |
v := #(2.0 2.0 1.0) asFloatArray. |
|
358 |
v dot:v. |
|
359 |
" |
|
360 |
" |
|
361 |
|v1 v2| |
|
362 |
||
363 |
v1 := FloatArray new:10000 withAll:2. |
|
364 |
v2 := FloatArray new:10000 withAll:3. |
|
365 |
Time millisecondsToRun:[ |
|
366 |
10000 timesRepeat:[ |
|
367 |
v1 dot:v2. |
|
368 |
] |
|
369 |
] |
|
370 |
" |
|
371 |
||
372 |
"Created: / 29-05-2007 / 13:13:39 / cg" |
|
373 |
! |
|
374 |
||
24307 | 375 |
esum |
376 |
"Return the sum of the elements. |
|
377 |
Reduces accumulated rounding errors. |
|
378 |
This is an experimental algorithm" |
|
379 |
||
380 |
%{ |
|
381 |
if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) { |
|
382 |
INT __mySize = __doubleArraySize(self); |
|
383 |
double __sum = 0.0; |
|
384 |
double *__pf = __DoubleArrayInstPtr(self)->d_element; |
|
385 |
#define NBITS_EXP 11 |
|
386 |
#define NIDX_EXP ((1<<NBITS_EXP)) |
|
387 |
#define MASK_EXP (NIDX_EXP-1) |
|
388 |
double sumsPerE[ NIDX_EXP]; |
|
389 |
int __i, __minIdx = MASK_EXP, __maxIdx = 0; |
|
390 |
||
391 |
memset(sumsPerE, 0, sizeof(double)*NIDX_EXP); |
|
392 |
||
393 |
for (__i=0; __i<__mySize; __i++) { |
|
394 |
union { |
|
395 |
double f; |
|
24333
e6d6a165972d
Replace uint32_t (not known in mingw)
Stefan Vogel <sv@exept.de>
parents:
24307
diff
changeset
|
396 |
unsigned int32 ui32[2]; |
24307 | 397 |
} u; |
398 |
int exp; |
|
399 |
||
400 |
u.f = __pf[__i]; |
|
401 |
#ifdef __LSBFIRST__ |
|
402 |
exp = (u.ui32[1] >> (32-1-NBITS_EXP)) & MASK_EXP; |
|
403 |
#else |
|
404 |
exp = (u.ui32[0] >> ((32-1-NBITS_EXP)) & MASK_EXP; |
|
405 |
#endif |
|
406 |
// printf("f:%04x %04x %04x %04x\n", u.ui32[0], u.ui32[1], u.ui32[2], u.ui32[3]); |
|
407 |
// printf("e:%d %lf + %lf -> %lf\n", exp, sumsPerE[exp], u.f, (sumsPerE[exp]+u.f)); |
|
408 |
sumsPerE[exp] += u.f; |
|
409 |
__minIdx = exp < __minIdx ? exp : __minIdx; |
|
410 |
__maxIdx = exp > __maxIdx ? exp : __maxIdx; |
|
411 |
} |
|
412 |
||
413 |
// printf("low:%d high:%d\n", __minIdx, __maxIdx); |
|
414 |
for (__i=__maxIdx; __i>=__minIdx; __i--) { |
|
415 |
__sum += sumsPerE[__i]; |
|
416 |
} |
|
417 |
RETURN (__MKFLOAT(__sum)); |
|
418 |
} |
|
419 |
%}. |
|
420 |
^ super sum |
|
421 |
||
422 |
" |
|
423 |
|v| |
|
424 |
v := #(2.0 2.0 1.0 1.0) asDoubleArray. |
|
425 |
v sum. |
|
426 |
v esum. |
|
427 |
||
428 |
|v| |
|
429 |
v := #(1e100 1.0 -1e100 1.0) asDoubleArray. |
|
430 |
v sum. |
|
431 |
v esum. |
|
432 |
" |
|
433 |
||
434 |
"Created: / 09-06-2019 / 13:48:38 / Claus Gittinger" |
|
435 |
! |
|
436 |
||
19031 | 437 |
hornerMultiplyAndAdd:x |
438 |
"primitive support for horner's-method computation of polynomials. |
|
439 |
The vector is interpreted as providing the factors for a polynomial, |
|
440 |
an*x^n + (an-1)*x^(n-1) + ... + a2(x) + a1 |
|
441 |
where the ai are the elements of the Array. |
|
442 |
The highest rank factor is at the first position, the 0-rank constant at last. |
|
443 |
This is inlined c-code, which may get compiled to fast machine code, |
|
444 |
using multiply-and-add or vector instructions, if the CPU/Compiler support them." |
|
445 |
||
446 |
| mySize result | |
|
447 |
||
448 |
%{ |
|
449 |
double __x; |
|
450 |
||
451 |
if (__isFloat(x)) { |
|
452 |
__x = __floatVal(x); |
|
453 |
} else if (__isShortFloat(x)) { |
|
454 |
__x = (double)__shortFloatVal(x); |
|
455 |
} else if (__isSmallInteger(x)) { |
|
456 |
__x = (double)(__intVal(x)); |
|
457 |
} else { |
|
458 |
goto getOutOfHere; |
|
459 |
} |
|
460 |
||
461 |
if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) { |
|
462 |
INT __mySize = __doubleArraySize(self); |
|
463 |
double *__elements = __DoubleArrayInstPtr(self)->d_element; |
|
464 |
double __result = __elements[0]; |
|
465 |
||
466 |
if (__mySize > 1) { |
|
467 |
INT __i; |
|
468 |
/* how about inline-mmx-asm for this ... */ |
|
469 |
for (__i=1; __i<__mySize; __i++) { |
|
470 |
__result = (__result * __x) + __elements[__i]; |
|
471 |
} |
|
472 |
} |
|
473 |
RETURN (__MKFLOAT(__result)); |
|
474 |
} |
|
475 |
getOutOfHere: ; |
|
476 |
%}. |
|
477 |
^ super hornerMultiplyAndAdd:x |
|
478 |
||
479 |
" |
|
480 |
|v| |
|
481 |
v := #(2.0 3.0 4.0) asDoubleArray. |
|
482 |
v hornerMultiplyAndAdd:10. |
|
483 |
||
484 |
|v| |
|
485 |
v := Array new:100 withAll:2.0. |
|
486 |
v hornerMultiplyAndAdd:10 |
|
487 |
||
488 |
|v| |
|
489 |
v := Array new:100 withAll:2.0. |
|
490 |
Time millisecondsToRun:[ |
|
491 |
10000 timesRepeat:[ v hornerMultiplyAndAdd:10] |
|
492 |
] |
|
493 |
||
494 |
|v| |
|
495 |
v := FloatArray new:100 withAll:2. |
|
496 |
Time millisecondsToRun:[ |
|
497 |
10000 timesRepeat:[ v hornerMultiplyAndAdd:10] |
|
498 |
] |
|
499 |
||
500 |
|v| |
|
501 |
v := DoubleArray new:100 withAll:2. |
|
502 |
Time millisecondsToRun:[ |
|
503 |
10000 timesRepeat:[ v hornerMultiplyAndAdd:10] |
|
504 |
] |
|
505 |
" |
|
24307 | 506 |
! |
507 |
||
508 |
sum |
|
509 |
"Return the sum of the elements. |
|
510 |
May suffer from accumulated rounding error" |
|
511 |
||
512 |
%{ |
|
513 |
if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) { |
|
514 |
INT __mySize = __doubleArraySize(self); |
|
515 |
double __sum = 0.0; |
|
516 |
double *__pf = __DoubleArrayInstPtr(self)->d_element; |
|
517 |
int __i; |
|
518 |
||
519 |
/* how about inline-mmx-asm for this ... */ |
|
520 |
for (__i=0; __i<__mySize; __i++) { |
|
521 |
__sum += __pf[__i]; |
|
522 |
} |
|
523 |
RETURN (__MKFLOAT(__sum)); |
|
524 |
} |
|
525 |
%}. |
|
526 |
^ super sum |
|
527 |
||
528 |
" |
|
529 |
|v| |
|
530 |
v := #(2.0 2.0 1.0) asDoubleArray. |
|
531 |
v sum. |
|
532 |
||
533 |
|v| |
|
534 |
v := #(1e100 1.0 -1e100 1.0) asDoubleArray. |
|
535 |
v sum. |
|
536 |
" |
|
537 |
||
538 |
"Created: / 09-06-2019 / 10:43:10 / Claus Gittinger" |
|
19031 | 539 |
! ! |
540 |
||
627 | 541 |
!DoubleArray class methodsFor:'documentation'! |
565 | 542 |
|
543 |
version |
|
19031 | 544 |
^ '$Header$' |
16853 | 545 |
! |
546 |
||
547 |
version_CVS |
|
19031 | 548 |
^ '$Header$' |
88 | 549 |
! ! |
16639 | 550 |