- Notifications
You must be signed in to change notification settings - Fork 149
/
Copy pathRealFunctions.swift
79 lines (68 loc) · 2.5 KB
/
RealFunctions.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//===--- RealFunctions.swift ----------------------------------*- swift -*-===//
//
// This source file is part of the Swift Numerics open source project
//
// Copyright (c) 2019 Apple Inc. and the Swift Numerics project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
//===----------------------------------------------------------------------===//
publicprotocolRealFunctions:ElementaryFunctions{
/// `atan(y/x)`, with sign selected according to the quadrant of `(x, y)`.
///
/// See also `atan()`.
staticfunc atan2(y:Self, x:Self)->Self
/// The error function evaluated at `x`.
///
/// See also `erfc()`.
staticfunc erf(_ x:Self)->Self
/// The complimentary error function evaluated at `x`.
///
/// See also `erf()`.
staticfunc erfc(_ x:Self)->Self
/// 2^x
///
/// See also `exp()`, `expMinusOne()`, `exp10()`, `log2()` and `pow()`.
staticfunc exp2(_ x:Self)->Self
/// 10^x
///
/// See also `exp()`, `expMinusOne()`, `exp2()`, `log10()` and `pow()`.
staticfunc exp10(_ x:Self)->Self
/// `sqrt(x*x + y*y)`, computed in a manner that avoids spurious overflow or
/// underflow.
staticfunc hypot(_ x:Self, _ y:Self)->Self
/// The gamma function Γ(x).
///
/// See also `logGamma()` and `signGamma()`.
staticfunc gamma(_ x:Self)->Self
/// The base-2 logarithm of `x`.
///
/// See also `exp2()`, `log()`, `log(onePlus:)` and `log10()`.
staticfunc log2(_ x:Self)->Self
/// The base-10 logarithm of `x`.
///
/// See also: `exp10()`, `log()`, `log(onePlus:)` and `log2()`.
staticfunc log10(_ x:Self)->Self
#if !os(Windows)
/// The logarithm of the absolute value of the gamma function, log(|Γ(x)|).
///
/// Not available on Windows targets.
///
/// See also `gamma()` and `signGamma()`.
staticfunc logGamma(_ x:Self)->Self
/// The sign of the gamma function, Γ(x).
///
/// For `x >= 0`, `signGamma(x)` is `.plus`. For negative `x`, `signGamma(x)`
/// is `.plus` when `x` is an integer, and otherwise it is `.minus` whenever
/// `trunc(x)` is even, and `.plus` when `trunc(x)` is odd.
///
/// This function is used together with `logGamma`, which computes the
/// logarithm of the absolute value of Γ(x), to recover the sign information.
///
/// Not available on Windows targets.
///
/// See also `gamma()` and `logGamma()`.
staticfunc signGamma(_ x:Self)->FloatingPointSign
#endif
}