001    package railo.runtime.op;
002    
003    import railo.runtime.exp.PageException;
004    
005    public class NumericOpDouble implements NumericOp {
006        
007    
008        public Double divideRef(Object left, Object right) throws PageException {
009                    double r = Caster.toDoubleValue(right);
010            if(r==0d)
011                            throw new ArithmeticException("Division by zero is not possible");
012                    return Caster.toDouble(Caster.toDoubleValue(left)/r);
013            }
014        
015        public Double exponentRef(Object left, Object right) throws PageException {
016                    return Caster.toDouble(StrictMath.pow(Caster.toDoubleValue(left),Caster.toDoubleValue(right)));
017            }
018        
019        public Double intdivRef(Object left, Object right) throws PageException {
020                    return Caster.toDouble(Caster.toIntValue(left)/Caster.toIntValue(right));
021            }
022        
023        public Double plusRef(Object left, Object right) throws PageException {
024                    return Caster.toDouble(Caster.toDoubleValue(left)+Caster.toDoubleValue(right));
025            }
026        
027        public Double minusRef(Object left, Object right) throws PageException {
028                    return Caster.toDouble(Caster.toDoubleValue(left)-Caster.toDoubleValue(right));
029            }
030        
031        public Double modulusRef(Object left, Object right) throws PageException {
032                    return Caster.toDouble(Caster.toDoubleValue(left)%Caster.toDoubleValue(right));
033            }
034        
035        public Double multiplyRef(Object left, Object right) throws PageException {
036                    return Caster.toDouble(Caster.toDoubleValue(left)*Caster.toDoubleValue(right));
037            }
038    }