@Override public DoubleValue dividedBy( long b ) { return Values.doubleValue( doubleValue() / b ); }
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 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 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 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 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 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 ); } }
@Test void shouldNotOverflowOnSafeAddition() { assertThat( overflowSafeAdd( Long.MAX_VALUE, 1 ), equalTo( doubleValue( (double) Long.MAX_VALUE + 1 ) ) ); }
private static Value calculateDistance( PointValue p1, PointValue p2 ) { if ( p1.getCoordinateReferenceSystem().equals( p2.getCoordinateReferenceSystem() ) ) { return doubleValue( p1.getCoordinateReferenceSystem().getCalculator().distance( p1, p2 ) ); } else { return NO_VALUE; } }
@Test public void checkNumericSinglePropertyDuplicates() throws Exception { double duplicatedNumber = 0.33d; Value property = Values.doubleValue( duplicatedNumber ); expectedException.expect( IndexEntryConflictException.class ); expectedException.expectMessage( format( "Both node 3 and node 4 share the property value %s", ValueTuple.of( property ) ) ); checkStrategy.checkForDuplicate( property, 3 ); checkStrategy.checkForDuplicate( property, 4 ); }