File tree 3 files changed +34
-8
lines changed
3 files changed +34
-8
lines changed Original file line number Diff line number Diff line change 190
190
REBYTE * ap = NULL ;
191
191
REBCNT len = 0 ;
192
192
REBCNT alen ;
193
- REBCNT v ;
194
- REBINT a ;
193
+ REBI64 v ;
194
+ REBI64 a ;
195
195
REBDEC dec ;
196
196
197
197
value = D_ARG (1 );
205
205
ASSERT2 (vp != NULL , RP_MISC );
206
206
207
207
if (IS_INTEGER (arg )) {
208
- a = VAL_INT32 (arg );
208
+ a = VAL_INT64 (arg );
209
209
ap = 0 ;
210
210
} else if (IS_DECIMAL (arg ) || IS_PERCENT (arg )) {
211
211
dec = VAL_DECIMAL (arg );
212
- a = (REBINT )dec ;
212
+ a = (REBI64 )dec ;
213
213
ap = 0 ;
214
214
} else if (IS_TUPLE (arg )) {
215
215
ap = VAL_TUPLE (arg );
219
219
} else Trap_Math_Args (REB_TUPLE , action );
220
220
221
221
for (;len > 0 ; len -- , vp ++ ) {
222
- v = * vp ;
222
+ v = ( REBI64 ) * vp ;
223
223
if (ap )
224
- a = (REBINT ) * ap ++ ;
224
+ a = (REBI64 ) * ap ++ ;
225
225
switch (action ) {
226
226
case A_ADD : v += a ; break ;
227
227
case A_SUBTRACT : v -= a ; break ;
228
228
case A_MULTIPLY :
229
229
if (IS_DECIMAL (arg ) || IS_PERCENT (arg ))
230
- v = (REBINT )(v * dec );
230
+ v = (REBI64 )(v * dec );
231
231
else
232
232
v *= a ;
233
233
break ;
234
234
case A_DIVIDE :
235
235
if (IS_DECIMAL (arg ) || IS_PERCENT (arg )) {
236
236
if (dec == 0.0 ) Trap0 (RE_ZERO_DIVIDE );
237
- v = (REBINT )Round_Dec (v /dec , 0 , 1.0 );
237
+ v = (REBI64 )Round_Dec (v /dec , 0 , 1.0 ); //@@ https://github.com/Oldes/Rebol-issues/issues/1974
238
238
} else {
239
239
if (a == 0 ) Trap0 (RE_ZERO_DIVIDE );
240
240
v /= a ;
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ dt [ ;- delta time
47
47
wrap load %units/datatype-test.r3
48
48
wrap load %units/parse-test.r3
49
49
wrap load %units/task-test.r3
50
+ wrap load %units/tuple-test.r3
50
51
51
52
recycle/torture
52
53
recycle
Original file line number Diff line number Diff line change
1
+ Rebol [
2
+ Title: "Rebol3 tuple test script"
3
+ Author: "Oldes, Peter W A Wood"
4
+ File: %tuple-test.r3
5
+ Tabs: 4
6
+ Needs: [%../quick-test-module.r3 ]
7
+ ]
8
+
9
+ ~~~start-file~~~ "TUPLE!"
10
+
11
+ ===start-group=== "tuple"
12
+ --test-- "tuple divide"
13
+ ;@@ https://github.com/Oldes/Rebol-issues/issues/1974
14
+ --assert (1.1.1 / 0.1 ) == 10.10.10
15
+ --assert (1.1.1 / 0.625 ) == 2.2.2 ;because round 1 / 0.625 = 2.0
16
+ --assert (1.1.1 / 1.953125E-3 ) == 255.255.255
17
+ --assert (1.1.1 / -1.0 ) == 0.0.0
18
+ --assert (1.1.1 / 4.656612873077393e-10 ) == 255.255.255
19
+
20
+ --test-- "tuple multiply"
21
+ --assert (1.1.1 * 2147483648.0 ) == 255.255.255
22
+
23
+ ===end-group===
24
+
25
+ ~~~end-file~~~
You can’t perform that action at this time.
0 commit comments