Mercurial Hosting > luan
changeset 1669:fdeb1879fe02
manual work
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 10 May 2022 17:04:24 -0600 |
parents | ef75d9ad5ce9 |
children | 0046c5eb3315 |
files | website/src/m.html.luan |
diffstat | 1 files changed, 273 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
diff -r ef75d9ad5ce9 -r fdeb1879fe02 website/src/m.html.luan --- a/website/src/m.html.luan Mon May 09 23:30:25 2022 -0600 +++ b/website/src/m.html.luan Tue May 10 17:04:24 2022 -0600 @@ -3061,6 +3061,279 @@ } } } + math_lib = { + title = "Mathematical Functions" + content = function() +%> +<p> +Include this library by: +</p> +<pre> + local Math = require "luan:Math.luan" +</pre> + +<p> +This library provides basic mathematical functions. +It provides all its functions and constants inside the table <code>Math</code>. +</p> +<% + end + subs = { + ["Math.abs"] = { + title = "<code>Math.abs (x)</code>" + content = function() +%> +<p> +Returns the absolute value of <code>x</code>. +</p> +<% + end + } + ["Math.acos"] = { + title = "<code>Math.acos (x)</code>" + content = function() +%> +<p> +Returns the arc cosine of <code>x</code> (in radians). +</p> +<% + end + } + ["Math.asin"] = { + title = "<code>Math.asin (x)</code>" + content = function() +%> +<p> +Returns the arc sine of <code>x</code> (in radians). +</p> +<% + end + } + ["Math.atan"] = { + title = "<code>Math.atan (y, x)</code>" + content = function() +%> +<p> +Returns the arc tangent of <code>y/x</code> (in radians), +but uses the signs of both parameters to find the +quadrant of the result. +(It also handles correctly the case of <code>x</code> being zero.) +</p> +<% + end + } + ["Math.ceil"] = { + title = "<code>Math.ceil (x)</code>" + content = function() +%> +<p> +Returns the smallest integral value larger than or equal to <code>x</code>. +</p> +<% + end + } + ["Math.cos"] = { + title = "<code>Math.cos (x)</code>" + content = function() +%> +<p> +Returns the cosine of <code>x</code> (assumed to be in radians). +</p> +<% + end + } + ["Math.deg"] = { + title = "<code>Math.deg (x)</code>" + content = function() +%> +<p> +Converts the angle <code>x</code> from radians to degrees. +</p> +<% + end + } + ["Math.exp"] = { + title = "<code>Math.exp (x)</code>" + content = function() +%> +<p> +Returns the value <em>e<sup>x</sup></em> +(where <code>e</code> is the base of natural logarithms). +</p> +<% + end + } + ["Math.floor"] = { + title = "<code>Math.floor (x)</code>" + content = function() +%> +<p> +Returns the largest integral value smaller than or equal to <code>x</code>. +</p> +<% + end + } + ["Math.fmod"] = { + title = "<code>Math.fmod (x, y)</code>" + content = function() +%> +<p> +Returns the remainder of the division of <code>x</code> by <code>y</code> +that rounds the quotient towards zero. +</p> +<% + end + } + ["Math.huge"] = { + title = "<code>Math.huge</code>" + content = function() +%> +<p> +A value larger than any other numerical value. +</p> +<% + end + } + ["Math.log"] = { + title = "<code>Math.log (x [, base])</code>" + content = function() +%> +<p> +Returns the logarithm of <code>x</code> in the given base. +The default for <code>base</code> is <em>e</em> +(so that the function returns the natural logarithm of <code>x</code>). +</p> +<% + end + } + ["Math.max"] = { + title = "<code>Math.max (x, ···)</code>" + content = function() +%> +<p> +Returns the argument with the maximum value, +according to the Lua operator <code><</code>. +</p> +<% + end + } + ["Math.max_integer"] = { + title = "<code>Math.max_integer</code>" + content = function() +%> +<p> +An integer with the maximum value for an integer. +</p> +<% + end + } + ["Math.min"] = { + title = "<code>Math.min (x, ···)</code>" + content = function() +%> +<p> +Returns the argument with the minimum value, +according to the Lua operator <code><</code>. +</p> +<% + end + } + ["Math.min_integer"] = { + title = "<code>Math.min_integer</code>" + content = function() +%> +<p> +An integer with the minimum value for an integer. +</p> +<% + end + } + ["Math.modf"] = { + title = "<code>Math.modf (x)</code>" + content = function() +%> +<p> +Returns the integral part of <code>x</code> and the fractional part of <code>x</code>. +</p> +<% + end + } + ["Math.pi"] = { + title = "<code>Math.pi</code>" + content = function() +%> +<p> +The value of <em>π</em>. +</p> +<% + end + } + ["Math.rad"] = { + title = "<code>Math.rad (x)</code>" + content = function() +%> +<p> +Converts the angle <code>x</code> from degrees to radians. +</p> +<% + end + } + ["Math.random"] = { + title = "<code>Math.random ([m [, n])</code>" + content = function() +%> +<p> +When called without arguments, +returns a pseudo-random float with uniform distribution +in the range <em>[0,1)</em>. +When called with two integers <code>m</code> and <code>n</code>, +<code>Math.random</code> returns a pseudo-random integer +with uniform distribution in the range <em>[m, n]</em>. +(The value <em>m-n</em> cannot be negative and must fit in a Luan integer.) +The call <code>Math.random(n)</code> is equivalent to <code>Math.random(1,n)</code>. +</p> + +<p> +This function is an interface to the underling +pseudo-random generator function provided by Java. +No guarantees can be given for its statistical properties. +</p> +<% + end + } + ["Math.sin"] = { + title = "<code>Math.sin (x)</code>" + content = function() +%> +<p> +Returns the sine of <code>x</code> (assumed to be in radians). +</p> +<% + end + } + ["Math.sqrt"] = { + title = "<code>Math.sqrt (x)</code>" + content = function() +%> +<p> +Returns the square root of <code>x</code>. +(You can also use the expression <code>x^0.5</code> to compute this value.) +</p> +<% + end + } + ["Math.tan"] = { + title = "<code>Math.tan (x)</code>" + content = function() +%> +<p> +Returns the tangent of <code>x</code> (assumed to be in radians). +</p> +<% + end + } + } + } } } }