public static DoubleValue atan2( AnyValue y, AnyValue x ) { if ( y instanceof NumberValue && x instanceof NumberValue ) { return doubleValue( Math.atan2( ((NumberValue) y).doubleValue(), ((NumberValue) x).doubleValue() ) ); } else { throw needsNumbers( "atan2()" ); } }
public static DoubleValue haversin( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( (1.0 - Math.cos( ((NumberValue) in).doubleValue() )) / 2 ); } else { throw needsNumbers( "haversin()" ); } }
public static DoubleValue toDegrees( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( Math.toDegrees( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "toDegrees()" ); } }
public static DoubleValue exp( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( Math.exp( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "exp()" ); } }
public static DoubleValue sin( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( Math.sin( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "sin()" ); } }
public static DoubleValue asin( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( Math.asin( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "asin()" ); } }
public static DoubleValue cos( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( Math.cos( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "cos()" ); } }
public static DoubleValue round( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( Math.round( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "round()" ); } }
public static DoubleValue toRadians( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( Math.toRadians( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "toRadians()" ); } }
public static DoubleValue sqrt( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( Math.sqrt( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "sqrt()" ); } }
public static AnyValue pow( AnyValue lhs, AnyValue rhs ) { if ( lhs instanceof NumberValue && rhs instanceof NumberValue ) { return doubleValue( Math.pow( ((NumberValue) lhs).doubleValue(), ((NumberValue) rhs).doubleValue() ) ); } throw new CypherTypeException( String.format( "Cannot raise `%s` to the power of `%s`", lhs.getTypeName(), rhs.getTypeName() ), null ); } }
public static DoubleValue ceil( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( Math.ceil( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "ceil()" ); } }
public static DoubleValue log10( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( Math.log10( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "log10()" ); } }
public static DoubleValue acos( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( Math.acos( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "acos()" ); } }
public static DoubleValue tan( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( Math.tan( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "tan()" ); } }
public static DoubleValue log( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( Math.log( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "log()" ); } }
public static LongValue signum( AnyValue in ) { if ( in instanceof NumberValue ) { return longValue( (long) Math.signum( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "signum()" ); } }
public static DoubleValue cot( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( 1.0 / Math.tan( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "cot()" ); } }
public DurationValue div( NumberValue number ) { double divisor = number.doubleValue(); try { return approximate( months / divisor, days / divisor, seconds / divisor, nanos / divisor ); } catch ( ArithmeticException e ) { throw invalidDurationDivision( this, number, e ); } }
public static FloatingPointValue asFloatingPointValue( AnyValue value ) { if ( !(value instanceof NumberValue) ) { throw cantCoerce( value, "Float" ); } return Values.doubleValue( ((NumberValue) value).doubleValue() ); }