Changeset 11718


Ignore:
Timestamp:
03/26/09 20:58:22 (13 years ago)
Author:
ehuelsmann
Message:

Fix multiplication of Complex values.

Patch by: Robert Dodier <robert_dodier at yahoo dot com>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/Complex.java

    r11488 r11718  
    222222        // xy = (ac - bd) + i(ad + bc)
    223223        // real part = ac - bd
    224         // imag part = (a + b)(c + d) - ac - bd
     224        // imag part = ad + bc
    225225        LispObject ac = a.multiplyBy(c);
    226226        LispObject bd = b.multiplyBy(d);
    227         return Complex.getInstance(ac.subtract(bd),
    228                                    a.add(b).multiplyBy(c.add(d)).subtract(ac).subtract(bd));
     227        LispObject ad = a.multiplyBy(d);
     228        LispObject bc = b.multiplyBy(c);
     229        return Complex.getInstance(ac.subtract(bd), ad.add(bc));
    229230      }
    230231    return Complex.getInstance(realpart.multiplyBy(obj),
Note: See TracChangeset for help on using the changeset viewer.