* src/math.c:

+ If one of the factors is the exact zero, the result yields exact zero.


git-svn-id: svn://svn.zoy.org/elk/trunk@249 55e467fa-43c5-0310-a8a2-de718669efc6
This commit is contained in:
sam 2004-01-29 13:55:42 +00:00
parent dc2d4e6819
commit ca7c9ff157
1 changed files with 6 additions and 0 deletions

View File

@ -746,6 +746,8 @@ Object Generic_Multiply (Object x, Object y) {
switch (TYPE(x)) {
case T_Fixnum:
if(FIXNUM(x) == 0)
return Zero;
switch (TYPE(y)) {
case T_Fixnum:
ret = Fixnum_Multiply (FIXNUM(x), FIXNUM(y));
@ -764,6 +766,8 @@ Object Generic_Multiply (Object x, Object y) {
case T_Flonum:
switch (TYPE(y)) {
case T_Fixnum:
if(FIXNUM(y) == 0)
return Zero;
return Make_Flonum (FLONUM(x)->val * FIXNUM(y));
case T_Flonum:
return Make_Flonum (FLONUM(x)->val * FLONUM(y)->val);
@ -775,6 +779,8 @@ Object Generic_Multiply (Object x, Object y) {
case T_Bignum:
switch (TYPE(y)) {
case T_Fixnum:
if(FIXNUM(y) == 0)
return Zero;
return Bignum_Fixnum_Multiply (x, y);
case T_Flonum:
return Make_Flonum (Bignum_To_Double (x) * FLONUM(y)->val);