These functions all operate on numerical expressions only, and will return an error if used on any other values.
See also Section 12.1.1, “Mathematical operators”.
ABS
returns the absolute value of a number.
Syntax: ABS( expression )
Arguments:
Query.
MATCH a, e WHERE a.name = 'Alice' AND e.name = 'Eskil' RETURN a.age, e.age, abs(a.age - e.age)
The absolute value of the age difference is returned.
ACOS
returns the arccosine of the expression, in radians.
Syntax: ACOS( expression )
Arguments:
Query.
START a=node(3) RETURN acos(0.5)
The arccosine of 0.5.
ASIN
returns the arcsine of the expression, in radians.
Syntax: ASIN( expression )
Arguments:
Query.
START a=node(3) RETURN asin(0.5)
The arcsine of 0.5.
ATAN
returns the arctangent of the expression, in radians.
Syntax: ATAN( expression )
Arguments:
Query.
START a=node(3) RETURN atan(0.5)
The arctangent of 0.5.
COS
returns the cosine of the expression.
Syntax: COS( expression )
Arguments:
Query.
START a=node(3) RETURN cos(0.5)
The cosine of 0.5 is returned.
COT
returns the cotangent of the expression.
Syntax: COT( expression )
Arguments:
Query.
START a=node(3) RETURN cot(0.5)
The cotangent of 0.5 is returned.
DEGREES
converts radians to degrees.
Syntax: DEGREES( expression )
Arguments:
Query.
START a=node(3) RETURN degrees(3.14159)
The number of degrees in something close to pi.
E
returns the constant, e.
Syntax: E( expression )
Arguments:
Query.
START a=node(3) RETURN e()
The constant e is returned (the base of natural log).
EXP
returns the value e raised to the power of the expression.
Syntax: EXP( expression )
Arguments:
Query.
START a=node(3) RETURN exp(2)
The exp of 2 is returned: e^2.
FLOOR
returns the greatest integer less than or equal to the expression.
Syntax: FLOOR( expression )
Arguments:
Query.
START a=node(3) RETURN floor(0.9)
The floor of 0.9 is returned.
LOG
returns the natural logarithm of the expression.
Syntax: LOG( expression )
Arguments:
Query.
START a=node(3) RETURN log(27)
The log of 27 is returned.
LOG10
returns the base 10 logarithm of the expression.
Syntax: LOG10( expression )
Arguments:
Query.
START a=node(3) RETURN log10(27)
The log10 of 27 is returned.
PI
returns the mathmatical constant pi.
Syntax: PI()
Arguments:
Query.
START a=node(3) RETURN pi()
The constant pi is returned.
RADIANS
converts degrees to radians.
Syntax: RADIANS( expression )
Arguments:
Query.
START a=node(3) RETURN radians(180)
The number of radians in 180 is returned (pi).
RAND
returns a random double between 0 and 1.0.
Syntax: RAND( expression )
Arguments:
Query.
START a=node(3) RETURN rand() AS x1
Two random numbers are returned.
ROUND
returns the numerical expression, rounded to the nearest integer.
Syntax: ROUND( expression )
Arguments:
Query.
MATCH a RETURN round(3.141592) LIMIT 1
SIGN
returns the signum of a number — zero if the expression is zero, -1
for any negative number, and 1
for any positive number.
Syntax: SIGN( expression )
Arguments:
Query.
MATCH n RETURN sign(-17), sign(0.1) LIMIT 1
SIN
returns the sine of the expression.
Syntax: SIN( expression )
Arguments:
Query.
START a=node(3) RETURN sin(0.5)
The sine of 0.5 is returned.
SQRT
returns the square root of a number.
Syntax: SQRT( expression )
Arguments:
Query.
MATCH n RETURN sqrt(256) LIMIT 1
Copyright © 2013 Neo Technology