File tree 2 files changed +23
-13
lines changed
2 files changed +23
-13
lines changed Original file line number Diff line number Diff line change 163
163
164
164
case A_DIVIDE :
165
165
if (arg == 0 ) Trap0 (RE_ZERO_DIVIDE );
166
- if (num < - MAX_I64 && arg == -1 ) Trap0 (RE_OVERFLOW );
166
+ if (arg == -1 ) {
167
+ if (num < - MAX_I64 ) Trap0 (RE_OVERFLOW );
168
+ num = - num ;
169
+ break ;
170
+ }
167
171
if (num % arg == 0 ) {
168
172
num = num / arg ;
169
173
break ;
Original file line number Diff line number Diff line change 206
206
switch (action ) {
207
207
208
208
case A_ADD :
209
- x1 += x2 ;
210
- y1 += y2 ;
209
+ x1 = ( REBCNT ) x1 + ( REBCNT ) x2 ;
210
+ y1 = ( REBCNT ) y1 + ( REBCNT ) y2 ;
211
211
goto setPair ;
212
212
213
213
case A_SUBTRACT :
214
- x1 -= x2 ;
215
- y1 -= y2 ;
214
+ x1 = ( REBCNT ) x1 - ( REBCNT ) x2 ;
215
+ y1 = ( REBCNT ) y1 - ( REBCNT ) y2 ;
216
216
goto setPair ;
217
217
218
218
case A_MULTIPLY :
219
- x1 *= x2 ;
220
- y1 *= y2 ;
219
+ x1 = ( REBCNT ) x1 * ( REBCNT ) x2 ;
220
+ y1 = ( REBCNT ) y1 * ( REBCNT ) y2 ;
221
221
goto setPair ;
222
222
223
223
case A_DIVIDE :
224
224
case A_REMAINDER :
225
225
if (x2 == 0 || y2 == 0 ) Trap0 (RE_ZERO_DIVIDE );
226
226
if (action == A_DIVIDE ) {
227
- x1 /= x2 ;
228
- y1 /= y2 ;
227
+ if (x2 == -1 )
228
+ x1 = - (REBCNT ) x1 ;
229
+ else
230
+ x1 /= x2 ;
231
+ if (y2 == -1 )
232
+ y1 = - (REBCNT ) y1 ;
233
+ else
234
+ y1 /= y2 ;
229
235
}
230
236
else {
231
237
x1 = (REBD32 )fmod (x1 , x2 );
247
253
DECIDE ((x1 & 1 ) == 0 && (y1 & 1 ) == 0 );
248
254
#endif
249
255
case A_NEGATE :
250
- x1 = - x1 ;
251
- y1 = - y1 ;
256
+ x1 = - ( REBCNT ) x1 ;
257
+ y1 = - ( REBCNT ) y1 ;
252
258
goto setPair ;
253
259
#ifdef temp
254
260
case A_COMPLEMENT :
257
263
goto setPair ;
258
264
#endif
259
265
case A_ABSOLUTE :
260
- if (x1 < 0 ) x1 = - x1 ;
261
- if (y1 < 0 ) y1 = - y1 ;
266
+ if (x1 < 0 ) x1 = - ( REBCNT ) x1 ;
267
+ if (y1 < 0 ) y1 = - ( REBCNT ) y1 ;
262
268
goto setPair ;
263
269
264
270
case A_ROUND :
You can’t perform that action at this time.
0 commit comments