Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class SloppyMath

    Math functions that trade off accuracy for speed.

    Inheritance
    object
    SloppyMath
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Util
    Assembly: Lucene.Net.dll
    Syntax
    public static class SloppyMath

    Methods

    Asin(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 NaN or its absolute value is greater than 1, then the result is NaN.
    Declaration
    public static double Asin(double a)
    Parameters
    Type Name Description
    double a

    the value whose arc sine is to be returned.

    Returns
    Type Description
    double

    arc sine of the argument

    See Also
    Asin(double)

    Cos(double)

    Returns the trigonometric cosine of an angle.

    Error is around 1E-15.

    Special cases:
    • If the argument is NaN or an infinity, then the result is NaN.
    Declaration
    public static double Cos(double a)
    Parameters
    Type Name Description
    double a

    An angle, in radians.

    Returns
    Type Description
    double

    The cosine of the argument.

    See Also
    Cos(double)

    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
    double latitude
    Returns
    Type Description
    double

    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
    double lat1

    Latitude of the first point.

    double lon1

    Longitude of the first point.

    double lat2

    Latitude of the second point.

    double lon2

    Longitude of the second point.

    Returns
    Type Description
    double

    distance in kilometers.

    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.