aboutsummaryrefslogtreecommitdiff
path: root/core/math.nom
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-12-30 23:58:47 -0800
committerBruce Hill <bruce@bruce-hill.com>2018-12-30 23:58:47 -0800
commit5059c081ac624ede925d5256885509ddd17181c6 (patch)
tree0457d135e5193126bf73466bfaae09df94ab8a7d /core/math.nom
parentec69ee6f62016a2edcc13e3183cbe4cadd75717f (diff)
Auto-upgraded code.
Diffstat (limited to 'core/math.nom')
-rw-r--r--core/math.nom18
1 files changed, 5 insertions, 13 deletions
diff --git a/core/math.nom b/core/math.nom
index d456bff..05b7dd8 100644
--- a/core/math.nom
+++ b/core/math.nom
@@ -13,10 +13,8 @@ use "core/collections.nom"
# Literals:
test:
assume (all of [inf, NaN, pi, tau, golden ratio, e]) or barf
- .."math constants failed"
-
+ "math constants failed"
$nan = (NaN)
-
assume ($nan != $nan) or barf "NaN failed"
[infinity, inf] all compile to "math.huge"
[not a number, NaN, nan] all compile to "(0/0)"
@@ -42,29 +40,23 @@ test:
[absolute value $, | $ |, abs $] all compile to "math.abs(\($ as lua expr))"
[square root $, square root of $, √ $, sqrt $] all compile to
-.."math.sqrt(\($ as lua expr))"
-
+ "math.sqrt(\($ as lua expr))"
[sine $, sin $] all compile to "math.sin(\($ as lua expr))"
-
[cosine $, cos $] all compile to "math.cos(\($ as lua expr))"
[tangent $, tan $] all compile to "math.tan(\($ as lua expr))"
[arc sine $, asin $] all compile to "math.asin(\($ as lua expr))"
[arc cosine $, acos $] all compile to "math.acos(\($ as lua expr))"
[arc tangent $, atan $] all compile to "math.atan(\($ as lua expr))"
[arc tangent $y / $x, atan2 $y $x] all compile to
-.."math.atan2(\($y as lua expr), \($x as lua expr))"
-
+ "math.atan2(\($y as lua expr), \($x as lua expr))"
[hyperbolic sine $, sinh $] all compile to "math.sinh(\($ as lua expr))"
-
[hyperbolic cosine $, cosh $] all compile to "math.cosh(\($ as lua expr))"
[hyperbolic tangent $, tanh $] all compile to "math.tanh(\($ as lua expr))"
[e^ $, exp $] all compile to "math.exp(\($ as lua expr))"
[natural log $, ln $, log $] all compile to "math.log(\($ as lua expr))"
[log $ base $base, log base $base of $] all compile to
-.."math.log(\($ as lua expr), \($base as lua expr))"
-
+ "math.log(\($ as lua expr), \($base as lua expr))"
(floor $) compiles to "math.floor(\($ as lua expr))"
-
[ceiling $, ceil $] all compile to "math.ceil(\($ as lua expr))"
[round $, $ rounded] all compile to "math.floor(\($ as lua expr) + .5)"
test:
@@ -204,7 +196,7 @@ externally (seed random with $) means:
(seed random) parses as (seed random with (=lua "os.time()"))
[random number, random, rand] all compile to "math.random()"
[random int $n, random integer $n, randint $n] all compile to
-.."math.random(\($n as lua expr))"
+ "math.random(\($n as lua expr))"
[random from $low to $high, random number from $low to $high, rand $low $high]
..all compile to "math.random(\($low as lua expr), \($high as lua expr))"