NumericAnnex Reference (100% documented)

View on GitHub

Install in Dash

Real

public protocol Real : Math, FloatingPoint

A floating-point type that supports elementary functions and a selection of special functions.

The Real protocol provides a suitable basis for writing functions that work on any floating-point type that supports the required functions.

Topics
  • hypot(_:_:) Default implementation

    Returns the hypotenuse of a right-angle triangle with legs (catheti) of length x and y, preventing avoidable arithmetic overflow and underflow. The return value is the square root of the sum of squares of the arguments.

    Declaration

    Swift

    static func hypot(_ x: Self, _ y: Self) -> Self
    Parameters
    x

    The length of one leg (cathetus) of a right-angle triangle.

    y

    The length of the other leg (cathetus) of a right-angle triangle.

  • inverseTangent(dividingBy:) Default implementation

    Returns the inverse tangent of self / other, using the signs of self and other to determine the quadrant of the computed angle.

    If self == 0 && other == 0, the return value is still finite.

    See also

    atan2(_:_:)

    Declaration

    Swift

    func inverseTangent(dividingBy other: Self) -> Self
    Parameters
    other

    The divisor by which to divide self.

  • error()

    Returns the value of the error function of self.

    See also

    erf(_:)
    Declaration

    Swift

    func error() -> Self
  • complementaryError()

    Returns the value of the complementary error function of self.

    See also

    erfc(_:)
    Declaration

    Swift

    func complementaryError() -> Self
  • gamma()

    Returns the value of the gamma function of self.

    See also

    tgamma(_:)
    Declaration

    Swift

    func gamma() -> Self
  • logarithmicGamma()

    Returns the value of the logarithmic gamma function of self.

    See also

    lgamma(_:)
    Declaration

    Swift

    func logarithmicGamma() -> Self
  • cubeRoot() Extension method

    Returns the cube root of the value, rounded to a representable value (default implementation).

    Note

    This method is required by the protocol Math; it is not an extension method.

    See also

    cbrt(_:)

    Declaration

    Swift

    public func cubeRoot() -> Self
  • atan2(_:_:) Extension method

    Returns the inverse tangent of y / x, using the signs of y and x to determine the quadrant of the computed angle.

    If x == 0 && y == 0, the return value is still finite.

    Declaration

    Swift

    public static func atan2(_ y: Self, _ x: Self) -> Self
    Parameters
    y

    The value to divide.

    x

    The divisor by which to divide y.

  • erf(_:) Extension method

    Returns the value of the error function of x.

    See also

    error()
    Declaration

    Swift

    public static func erf(_ x: Self) -> Self
  • erfc(_:) Extension method

    Returns the value of the complementary error function of x.

    Declaration

    Swift

    public static func erfc(_ x: Self) -> Self
  • tgamma(_:) Extension method

    Returns the value of the gamma function of x.

    See also

    gamma()
    Declaration

    Swift

    public static func tgamma(_ x: Self) -> Self
  • lgamma(_:) Extension method

    Returns the value of the logarithmic gamma function of x.

    Declaration

    Swift

    public static func lgamma(_ x: Self) -> Self