001    package railo.runtime.op;
002    
003    import java.math.BigDecimal;
004    
005    import railo.runtime.exp.PageException;
006    
007    public class NumericOpBigDecimal implements NumericOp {
008    
009    
010        public BigDecimal divideRef(Object left, Object right) throws PageException {
011                    double r = Caster.toDoubleValue(right);
012            if(r==0d)
013                            throw new ArithmeticException("Division by zero is not possible");
014            return Caster.toBigDecimal(left).divide(Caster.toBigDecimal(right));
015            }
016        
017        public BigDecimal exponentRef(Object left, Object right) throws PageException {
018            return Caster.toBigDecimal(left).divide(Caster.toBigDecimal(right)); // !!!
019            }
020        
021        public BigDecimal intdivRef(Object left, Object right) throws PageException {
022            return Caster.toBigDecimal(left).divide(Caster.toBigDecimal(right));// !!!!
023            }
024        
025        public BigDecimal plusRef(Object left, Object right) throws PageException {
026            return Caster.toBigDecimal(left).add(Caster.toBigDecimal(right));
027            }
028        
029        public BigDecimal minusRef(Object left, Object right) throws PageException {
030            return Caster.toBigDecimal(left).subtract(Caster.toBigDecimal(right));
031            }
032        
033        public BigDecimal modulusRef(Object left, Object right) throws PageException {
034            return Caster.toBigDecimal(left).multiply(Caster.toBigDecimal(right)); /// ????
035            }
036        
037        
038        public BigDecimal multiplyRef(Object left, Object right) throws PageException {
039                    return Caster.toBigDecimal(left).multiply(Caster.toBigDecimal(right));
040            }
041    }