Skip to content

Commit

Permalink
Update math.lnx
Browse files Browse the repository at this point in the history
  • Loading branch information
rhpo authored Nov 1, 2023
1 parent a3bcbba commit e7a5b4f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/math.lnx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
# Module: Math
# Date: Tue Aug 22 2023 10:03:48

# Make a function to calculate the absolute value of n
# Absolute Function: to calculate the absolute value of n
out fn abs n {
n < 0 ? -n or n
}

# Approximately Equal function: returns equality of a and b at a certain precision (epsilon) => boolean
out fn approx a b epsilon=(0.01) {
return abs(a - b) < epsilon
}

pi: out = math.pi

0 comments on commit e7a5b4f

Please sign in to comment.