mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-27 08:43:09 -03:00
committed by
Johannes Altmanninger
parent
2d29749eae
commit
47c773300a
@@ -7,6 +7,10 @@ Notable improvements and fixes
|
||||
Deprecations and removed features
|
||||
---------------------------------
|
||||
|
||||
Scripting improvements
|
||||
----------------------
|
||||
- ``math`` gained a new ``logb`` function.
|
||||
|
||||
Interactive improvements
|
||||
------------------------
|
||||
- When typing immediately after starting fish, the first prompt is now rendered correctly.
|
||||
|
||||
@@ -156,6 +156,8 @@ Functions
|
||||
the base-10 logarithm
|
||||
``log2``
|
||||
the base-2 logarithm
|
||||
``logb(b,x)``
|
||||
returns the logarithm with base b of x
|
||||
``max``
|
||||
returns the largest of the given numbers - this takes an arbitrary number of arguments (but at least one)
|
||||
``min``
|
||||
|
||||
@@ -291,6 +291,7 @@ fn npr(n: f64, r: f64) -> f64 {
|
||||
(L!("log"), Function::Fn1(f64::log10)),
|
||||
(L!("log10"), Function::Fn1(f64::log10)),
|
||||
(L!("log2"), Function::Fn1(f64::log2)),
|
||||
(L!("logb"), Function::Fn2(|base, x| x.log(base))),
|
||||
(L!("max"), Function::FnN(maximum)),
|
||||
(L!("min"), Function::FnN(minimum)),
|
||||
(L!("ncr"), Function::Fn2(ncr)),
|
||||
|
||||
@@ -276,6 +276,21 @@ echo $status
|
||||
math 'log2(8)'
|
||||
# CHECK: 3
|
||||
|
||||
math 'logb(2, 8)'
|
||||
# CHECK: 3
|
||||
math 'logb(67, 406067677556641)'
|
||||
# CHECK: 8
|
||||
math 'logb(42, 230539333248)'
|
||||
# CHECK: 7
|
||||
math 'logb(12, 8916100448256)'
|
||||
# CHECK: 12
|
||||
math 'logb(3, 5559060566555523)'
|
||||
# CHECK: 33
|
||||
math 'logb(5, 2384185791015625)'
|
||||
# CHECK: 22
|
||||
math 'logb(7, 343)'
|
||||
# CHECK: 3
|
||||
|
||||
# same as sin(cos(2 x pi))
|
||||
math sin cos 2 x pi
|
||||
# CHECK: 0.841471
|
||||
|
||||
Reference in New Issue
Block a user