Class SloppyMath
Math functions that trade off accuracy for speed.
Inheritance
System.Object
SloppyMath
Namespace: Lucene.Net.Util
Assembly: Lucene.Net.dll
Syntax
public class SloppyMath : object
Methods
| Improve this Doc View SourceAsin(Double)
Returns the arc sine of a value.
The returned angle is in the range -pi/2 through pi/2. Error is around 1E-7.
Special cases:
- If the argument is
or its absolute value is greater than 1, then the result is .
Declaration
public static double Asin(double a)
Parameters
Type | Name | Description |
---|---|---|
System. |
a | the value whose arc sine is to be returned. |
Returns
Type | Description |
---|---|
System. |
arc sine of the argument |
Cos(Double)
Returns the trigonometric cosine of an angle.
Error is around 1E-15.
Special cases:
- If the argument is
or an infinity, then the result is .
Declaration
public static double Cos(double a)
Parameters
Type | Name | Description |
---|---|---|
System. |
a | An angle, in radians. |
Returns
Type | Description |
---|---|
System. |
The cosine of the argument. |
EarthDiameter(Double)
Return an approximate value of the diameter of the earth at the given latitude, in kilometers.
Declaration
public static double EarthDiameter(double latitude)
Parameters
Type | Name | Description |
---|---|---|
System. |
latitude |
Returns
Type | Description |
---|---|
System. |
Haversin(Double, Double, Double, Double)
Returns the distance in kilometers between two points specified in decimal degrees (latitude/longitude).
Declaration
public static double Haversin(double lat1, double lon1, double lat2, double lon2)
Parameters
Type | Name | Description |
---|---|---|
System. |
lat1 | Latitude of the first point. |
System. |
lon1 | Longitude of the first point. |
System. |
lat2 | Latitude of the second point. |
System. |
lon2 | Longitude of the second point. |
Returns
Type | Description |
---|---|
System. |
distance in kilometers. |