Initial revision
[LeanCalc.git] / help / abs
1 NAME
2     abs - absolute value
3
4 SYNOPSIS
5     abs(x [,eps])
6
7 TYPES
8     If x is an object of type xx, the function xx_abs has to have
9         been defined; this will determine the types for x, eps and
10         the returned value.
11
12     For non-object x and eps:
13
14     x           number (real or complex)
15     eps         ignored if x is real, nonzero real for complex x,
16                 defaults to epsilon().
17
18     return      non-negative real
19
20 DESCRIPTION
21     If x is real, returns the absolute value of x, i.e. x if x >= 0,
22     -x if x < 0.
23
24     For complex x with zero real part, returns the absolute value of im(x).
25
26     For other complex x, returns the multiple of eps nearest to the absolute
27     value of x, or in the case of two equally near nearest values, the
28     the nearest even multiple of eps.  In particular, with eps = 10^-n,
29     the result will be the absolute value correct to n decimal places.
30
31 EXAMPLE
32     > print abs(3.4), abs(-3.4)
33     3.4 3.4
34
35     > print abs(3+4i, 1e-5), abs(4+5i, 1e-5), abs(4+5i, 1e-10)
36     5 6.40312 6.4031242374
37
38 LIMITS
39     none
40
41 LINK LIBRARY
42     NUMBER *qqabs(NUMBER *x)
43
44 SEE ALSO
45     cmp, epsilon, hypot, norm, near, obj
46