File: stdmathlib.rst

package info (click to toggle)
squirrel3 3.1-8.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,380 kB
  • sloc: cpp: 12,722; ansic: 917; makefile: 316; python: 40
file content (111 lines) | stat: -rw-r--r-- 2,217 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
.. _stdlib_stdmathlib:

================
The Math library
================

the math lib provides basic mathematic routines. The library mimics the
C runtime library implementation.

------------
Squirrel API
------------

+++++++++++++++
Global Symbols
+++++++++++++++

.. js:function:: abs(x)

    returns the absolute value of `x` as an integer

.. js:function:: acos(x)

    returns the arccosine of `x`

.. js:function:: asin(x)

    returns the arcsine of `x`

.. js:function:: atan(x)

    returns the arctangent of `x`

.. js:function:: atan2(x,y)

    returns the arctangent of  `x/y`

.. js:function:: ceil(x)

    returns a float value representing the smallest integer that is greater than or equal to `x`

.. js:function:: cos(x)

    returns the cosine of `x`

.. js:function:: exp(x)

    returns the exponential value of the float parameter `x`

.. js:function:: fabs(x)

    returns the absolute value of `x` as a float

.. js:function:: floor(x)

    returns a float value representing the largest integer that is less than or equal to `x`

.. js:function:: log(x)

    returns the natural logarithm of `x`

.. js:function:: log10(x)

    returns the logarithm base-10 of `x`

.. js:function:: pow(x,y)

    returns `x` raised to the power of `y`

.. js:function:: rand()

    returns a pseudorandom integer in the range 0 to `RAND_MAX`

.. js:function:: sin(x)

    rreturns the sine of `x`

.. js:function:: sqrt(x)

    returns the square root of `x`

.. js:function:: srand(seed)

    sets the starting point for generating a series of pseudorandom integers

.. js:function:: tan(x)

    returns the tangent of `x`

.. js:data:: RAND_MAX

    the maximum value that can be returned by the `rand()` function

.. js:data:: PI

    The numeric constant pi (3.141592) is the ratio of the circumference of a circle to its diameter

------------
C API
------------

.. _sqstd_register_mathlib:

.. c:function:: SQRESULT sqstd_register_mathlib(HSQUIRRELVM v)

    :param HSQUIRRELVM v: the target VM
    :returns: an SQRESULT
    :remarks: The function aspects a table on top of the stack where to register the global library functions.

    initializes and register the math library in the given VM.