- debugmsg("operator*(ex,ex)",LOGLEVEL_OPERATOR);
- return lh.exmul(rh);
-}
-
-ex operator/(const ex & lh, const ex & rh)
-{
- debugmsg("operator*(ex,ex)",LOGLEVEL_OPERATOR);
- return lh.exmul(power(rh,_ex_1()));
+ // Check if we are constructing a mul object or a ncmul object. Due to
+ // ncmul::eval()'s rule to pull out commutative elements we need to check
+ // only one of the elements.
+ if (rh.return_type()==return_types::commutative ||
+ lh.return_type()==return_types::commutative)
+ return (new mul(lh,rh))->setflag(status_flags::dynallocated);
+ else
+ return (new ncmul(lh,rh))->setflag(status_flags::dynallocated);