mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
Update math_functions.nu
fixed precision
This commit is contained in:
parent
5d21a57212
commit
4a28cab81d
1 changed files with 3 additions and 3 deletions
|
@ -4,17 +4,17 @@
|
|||
|
||||
# cube root
|
||||
def croot [num: number] {
|
||||
$num ** ( 1 / 3 ) | math round
|
||||
$num ** ( 1 / 3 ) | math round -p 4
|
||||
}
|
||||
|
||||
# root with custom denominator, e.g. 2 ** 1/4
|
||||
def root [ denominator: number, num: number ] {
|
||||
$num ** ( 1 / $denominator ) | math round
|
||||
$num ** ( 1 / $denominator ) | math round -p 4
|
||||
}
|
||||
|
||||
# totally custom root, e.g. 2 ** 3/8
|
||||
def aroot [ scaler: number, denominator: number, num: number ] {
|
||||
$num ** ($scaler / $denominator) | math round
|
||||
$num ** ($scaler / $denominator) | math round -p 4
|
||||
}
|
||||
|
||||
#discriminant of a quadratic equation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue