haversin()
returns half the versine of a number.
Versine of an angle is 1 minus it’s cosine. It can also be calculated as twice the square of sine of half of the number(2 sin2(θ/2)).
Syntax: haversin(expression)
Returns: A Float.
Arguments
Name | Description |
expression | A numeric expression that represents the angle in radians. |
Example
RETURN acos(0.5)
The value returned will be the half of the versine of 0.5 radians, which is 0.06120871905481362.
Considerations
haversin(null)
returnsnull
.
Example
RETURN haversin(0.1)
Returns the following Result
haversin(0.1) |
0.0024979173609870897 |
Example
RETURN haversin(0.8)
Returns the following Result
haversin(0.8) |
0.1516466453264173 |
Example
RETURN haversin(-4)
Returns the following Result
haversin(-0.4) |
0.8268218104318059 |
Example
RETURN haversin(1)
Returns the following Result
haversin(1) |
0.22984884706593012 |
Example
RETURN haversin(0)
Returns the following Result
haversin(0) |
0.0 |
Example
RETURN haversin(null)
Returns the following Result
haversin(null) |
null |
Note– haversin(null)
returns null
.