mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-19 17:02:45 +08:00
math: Implement tau
This commit is contained in:
parent
f14a1d3a27
commit
5eb4de4285
|
@ -61,7 +61,7 @@ Constants
|
|||
``math`` knows the following constants:
|
||||
|
||||
- ``e`` - Euler's number.
|
||||
- ``pi`` - You know that one. Half of Tau. (Tau is not implemented)
|
||||
- ``pi`` - You know that one. Half of Tau. (``tau`` is also implemented)
|
||||
|
||||
Use them without a leading ``$`` - ``pi - 3`` should be about 0.
|
||||
|
||||
|
|
|
@ -137,6 +137,7 @@ void te_free(te_expr *n) {
|
|||
}
|
||||
|
||||
static constexpr double pi() { return M_PI; }
|
||||
static constexpr double tau() { return 2 * M_PI; }
|
||||
static constexpr double e() { return M_E; }
|
||||
|
||||
static double fac(double a) { /* simplest version of fac */
|
||||
|
@ -209,7 +210,9 @@ static const te_builtin functions[] = {
|
|||
{"sinh", reinterpret_cast<const void *>(static_cast<te_fun1>(sinh)), TE_FUNCTION1},
|
||||
{"sqrt", reinterpret_cast<const void *>(static_cast<te_fun1>(sqrt)), TE_FUNCTION1},
|
||||
{"tan", reinterpret_cast<const void *>(static_cast<te_fun1>(tan)), TE_FUNCTION1},
|
||||
{"tanh", reinterpret_cast<const void *>(static_cast<te_fun1>(tanh)), TE_FUNCTION1}};
|
||||
{"tanh", reinterpret_cast<const void *>(static_cast<te_fun1>(tanh)), TE_FUNCTION1},
|
||||
{"tau", reinterpret_cast<const void *>(static_cast<te_fun0>(tau)), TE_FUNCTION0},
|
||||
};
|
||||
|
||||
static const te_builtin *find_builtin(const char *name, int len) {
|
||||
const auto end = std::end(functions);
|
||||
|
|
Loading…
Reference in New Issue
Block a user