version 1.6, 2006/10/22 20:45:34
|
version 1.7, 2006/10/23 08:45:00
|
Line 116 DCell smdiv (DCell num, Cell denom) /* s
|
Line 116 DCell smdiv (DCell num, Cell denom) /* s
|
if (denomsign < 0) |
if (denomsign < 0) |
denom = -denom; |
denom = -denom; |
res = UD2D(umdiv (D2UD(num), denom)); |
res = UD2D(umdiv (D2UD(num), denom)); |
if (res.lo > (UCell)CELL_MIN) |
|
throw(BALL_RESULTRANGE); |
|
if ((numsign^denomsign)<0) { |
if ((numsign^denomsign)<0) { |
res.lo = -res.lo; |
res.lo = -res.lo; |
|
if (((Cell)res.lo) > 0) /* note: == 0 is possible */ |
|
throw(BALL_RESULTRANGE); |
} else { |
} else { |
if (res.lo == CELL_MIN) |
if (((Cell)res.lo) < 0) |
throw(BALL_RESULTRANGE); |
throw(BALL_RESULTRANGE); |
} |
} |
if (numsign<0) |
if (numsign<0) |
Line 144 DCell fmdiv (DCell num, Cell denom) /* f
|
Line 144 DCell fmdiv (DCell num, Cell denom) /* f
|
if (numsign < 0) |
if (numsign < 0) |
num.hi += denom; |
num.hi += denom; |
res = UD2D(umdiv(D2UD(num),denom)); |
res = UD2D(umdiv(D2UD(num),denom)); |
if (numsign < 0) { |
if ((numsign^((Cell)res.lo)) < 0) |
if (res.lo < (UCell)CELL_MIN) |
throw(BALL_RESULTRANGE); |
throw(BALL_RESULTRANGE); |
|
} else { |
|
if (res.lo >= (UCell)CELL_MIN) |
|
throw(BALL_RESULTRANGE); |
|
} |
|
if (denomsign<0) |
if (denomsign<0) |
res.hi = -res.hi; |
res.hi = -res.hi; |
return res; |
return res; |