File: maths.1.in

package info (click to toggle)
filepp 1.7.1-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,120 kB
  • ctags: 240
  • sloc: perl: 2,597; makefile: 489; sh: 174; ansic: 15
file content (72 lines) | stat: -rw-r--r-- 2,241 bytes parent folder | download | duplicates (6)
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
.\"  Hey Emacs! This file is -*- nroff -*- source.
.\" __FILEPP_INPUT__ version __VERSION__
.\" filepp is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation; either version 2 of the License, or
.\" (at your option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; see the file COPYING.  If not, write to
.\" the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
.\"
.SH MATHS MODULE - maths.pm
The module provides a set of macros which perform mathematical
operations.  When the macros are encoutered in an input file, they are
evaluated and the result is returned in the output.
.PP
The maths module includes the following macros:
.TP
.BR "add(a, b, c, ...)"
Takes in any number of arguments and returns their sum: (a + b + c + ...)
.TP
.BR "sub(a, b)"
Returns a minus b: (a - b)
.TP
.BR "mul(a, b, c, ...)"
Takes in any number of arguments and returns their product:
(a * b * c * ...)
.TP
.BR "div(a, b)"
Returns a over b: (a / b)
.TP
.BR "abs(a)"
Returns the absoulte value of a.
.TP
.BR "atan2(a, b)"
Returns the arctangent of a/b in the range -pi to pi.
.TP
.BR "cos(a)"
Returns the cosine of a in radians.
.TP
.BR "exp(a)"
Returns the e to the power of a.
.TP
.BR "int(a)"
Returns the integer portion of a.
.TP
.BR "log(a)"
Returns the natural logarithm (base e) of a.
.TP
.BR "rand(a)"
Returns a random fractional number between the range 0 and a.  If a is
omitted, returns a value between 0 and 1.
.TP
.BR "sin(a)"
Returns the sine of a in radians.
.TP
.BR "sqrt(a)"
Returns the square root of a.
.TP
.BR "srand(a)"
Sets the random number seed for rand().
.PP
The maths module also defines pi as M_PI as e as M_E. 
.PP
The maths macros are implemented using the \fBfunction.pm\fP module.
Nested macros are allowed, as is passing other macros with numerical
defintions as arguments.