diff options
Diffstat (limited to 'stdlib/source/lux/math.lux')
-rw-r--r-- | stdlib/source/lux/math.lux | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/stdlib/source/lux/math.lux b/stdlib/source/lux/math.lux index 7193b417f..420e0bc83 100644 --- a/stdlib/source/lux/math.lux +++ b/stdlib/source/lux/math.lux @@ -213,6 +213,38 @@ (def: #export (pow param subject) (-> Frac Frac Frac) (:coerce Frac ("ruby object do" "**" subject param)))) + + @.php + (as_is (template [<name> <method>] + [(def: #export <name> + (-> Frac Frac) + (|>> ("php apply" ("php constant" <method>)) + (:coerce Frac)))] + + [cos "cos"] + [sin "sin"] + [tan "tan"] + + [acos "acos"] + [asin "asin"] + [atan "atan"] + + [exp "exp"] + [log "log"] + + [ceil "ceil"] + [floor "floor"] + + [root/2 "sqrt"] + ) + + (def: #export (pow param subject) + (-> Frac Frac Frac) + (:coerce Frac ("php apply" ("php constant" "pow") subject param))) + + (def: #export root/3 + (-> Frac Frac) + (..pow ("lux f64 /" +3.0 +1.0)))) }) (def: #export (round input) |