Doubles LibraryThis library provides methods for doubles.
x = @ '4.9' y = @(123)
Doubles are created as objects using @.
y = x:new()
creates a new object, initially with the value of x.
local pi in dbl
creates a local variable within a chunk whose value
is the double pi.
Standard arithmetic operators, +, -, *, / create new
doubles if at least one of the operands is a double.
The following methods take one argument:
add, sub, mul, div, tostring
The argument to tostring is a format string as for
the printf function in C.
These take no argument:
abs inv ceil floor log exp sqrt sin cos tan asin acos atan sinh cosh tanh
This takes an integer argument:
ldexp
The operator # converts a double to an integer.
The function
dbl.rand
takes no arguments and returns a random double
between 0 and 1. The function
dbl.srand
takes an integer argument as seed for the random
number generator.
|
|
|