--- a/SmallInteger.st Thu Oct 08 11:34:52 2015 +0200
+++ b/SmallInteger.st Thu Oct 08 13:38:36 2015 +0200
@@ -407,13 +407,19 @@
__qMKSFLOAT(newFloat, val);
RETURN ( newFloat );
} else if (__isFractionLike(aNumber)) {
+ INT myValue = __intVal(self);
OBJ t = __FractionInstPtr(aNumber)->f_numerator;
+
+ if (myValue == 0) {
+ RETURN(__mkSmallInteger(0));
+ }
+
if (__isSmallInteger(t)) {
INT num = __intVal(t);
t = __FractionInstPtr(aNumber)->f_denominator;
if (__isSmallInteger(t)) {
- INT prod = __intVal(self) * num;
- if (prod / __intVal(self) == num) { // check for overflow
+ INT prod = myValue * num;
+ if (prod / myValue == num) { // check for overflow
INT den = __intVal(t);
INT quo = prod / den;
if (quo * den == prod) { // check for integer result