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.
-
Returns the hypotenuse of a right-angle triangle with legs (catheti) of length
x
andy
, 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.
-
Returns the inverse tangent of
self / other
, using the signs ofself
andother
to determine the quadrant of the computed angle.If
self == 0 && other == 0
, the return value is still finite.See also
Declaration
Swift
func inverseTangent(dividingBy other: Self) -> Self
Parameters
other
-
The divisor by which to divide
self
.
-
Returns the value of the error function of
self
.See also
erf(_:)
Declaration
Swift
func error() -> Self
-
Returns the value of the complementary error function of
self
.See also
erfc(_:)
Declaration
Swift
func complementaryError() -> Self
-
Returns the value of the gamma function of
self
.See also
tgamma(_:)
Declaration
Swift
func gamma() -> Self
-
Returns the value of the logarithmic gamma function of
self
.See also
lgamma(_:)
Declaration
Swift
func logarithmicGamma() -> Self
-
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
-
Returns the inverse tangent of
y / x
, using the signs ofy
andx
to determine the quadrant of the computed angle.If
x == 0 && y == 0
, the return value is still finite.See also
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
.
-
Returns the value of the error function of
x
.See also
error()
Declaration
Swift
public static func erf(_ x: Self) -> Self
-
Returns the value of the complementary error function of
x
.See also
complementaryError()
Declaration
Swift
public static func erfc(_ x: Self) -> Self
-
Returns the value of the gamma function of
x
.See also
gamma()
Declaration
Swift
public static func tgamma(_ x: Self) -> Self
-
Returns the value of the logarithmic gamma function of
x
.See also
logarithmicGamma()
Declaration
Swift
public static func lgamma(_ x: Self) -> Self