/[svn]/doc/docbase/instrument_scripts/nksp/reference/functions/nksp_abs_function.html
ViewVC logotype

Annotation of /doc/docbase/instrument_scripts/nksp/reference/functions/nksp_abs_function.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3601 - (hide annotations) (download) (as text)
Mon Sep 16 16:03:36 2019 UTC (4 years, 7 months ago) by schoenebeck
File MIME type: text/html
File size: 1815 byte(s)
* NKSP: Added recently added built-in functions to reference docs.
* NKSP: Added info about std units and finalness to existing functions.
* NKSP: Added recently added built-in constants ~NI_MATH_E and ~NI_MATH_PI.

1 schoenebeck 2732 <html>
2     <head>
3     <meta name="author" content="Christian Schoenebeck">
4     <title>abs() function</title>
5     <meta name="description" content="Calculates the absolute value of a given value.">
6     </head>
7     <body>
8     <h1>abs()</h1>
9     <p>
10     Returns the absolute value of the passed value argument. That means, if a
11     positive number or zero is passed, then the same number is returned.
12     If however a negative number is passed, then the signment of the number
13     is flipped to positive. So it behaves like simply removing the minus
14     sign if any.
15     </p>
16 schoenebeck 3601
17 schoenebeck 2732 <h3>Function Prototype</h3>
18     <p/>
19 schoenebeck 2742 <code lang="nksp">
20 schoenebeck 2732 abs(??number??)
21     </code>
22    
23     <h3>Arguments</h3>
24     <table>
25     <tr>
26     <th>Argument Name</th> <th>Data Type</th> <th>Description</th>
27     </tr>
28     <tr>
29     <td><code>??number??</code></td>
30 schoenebeck 3601 <td>Integer&nbsp;Number&nbsp;or<br>
31     Real&nbsp;Number</td>
32     <td>The number to be converted.<br>
33 schoenebeck 2732 [required]</td>
34     </tr>
35     </table>
36 schoenebeck 3601
37 schoenebeck 2732 <h3>Return Value</h3>
38     <table>
39     <tr>
40 schoenebeck 3578 <th>Data Type</th> <th>Description</th>
41 schoenebeck 2732 </tr>
42     <tr>
43 schoenebeck 3601 <td>Same as <code>??number??</code></td>
44 schoenebeck 2732 <td>Absolute value of the passed number.</td>
45     </tr>
46     </table>
47 schoenebeck 3601
48     <h3>Remarks</h3>
49     <p>
50     This functions accepts any standard unit and finalness for its argument <code>??number??</code>.
51     The return value's standard unit and finalness is identical to the passed <code>??number??</code>'s one.
52     </p>
53    
54 schoenebeck 2732 <h3>Examples</h3>
55     <p/>
56     <code>
57     on init
58     declare %values[7] := ( -3, -2, -1, 0, 1, 2, 3 )
59     declare $i := 0
60     while ($i < num_elements(values))
61     message("The absolute value of " & $values[$i] & " is " & abs($values[$i]))
62     end while
63     end on
64     </code>
65    
66     </body>
67     </html>

  ViewVC Help
Powered by ViewVC