1
Fork 0
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:
Kamil 2021-10-23 17:55:23 +00:00 committed by GitHub
parent 5d21a57212
commit 4a28cab81d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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