This HTML automatically generated with rman for NEMO
Table of Contents
nemoinp - parse a user supplied number string
nemoinp [parameter=value]
...
nemoinp parses an expression supplied by the user, using the
rules as given by nemoinp(3NEMO)
. The output format can be defined too,
separators, newlines etc. can be choosen at will. See also the EXAMPLES below.
It may come in handy to set an array in a shell variable or to initialize
tables, e.g. nemoinp 1:10:2 will then result in 1 3 5 7 9. Although such
implied loops are a common feature of scripting environments, there are
subtle differences:
nemoinp 1:10:2
matlab 1:2:10
seq 1 2 10
numpy.arange 1,10,2 last element (10) is never used
The following parameters are recognized in any order if the
keyword is also given:
- expression=expr-string
- expression to be parsed [default:
empty ].
- separ=string
- The string which is appended to the format string
described in previous keyword and is used to separate the numbers output.
When no string is supplied, a blank is used. [default: empty].
- format=string
- Valid C-format descriptor used in printf(3)
to output the numbers. When %d
is used, integer math is forced. See also next keyword for output number
separator. [default: %g].
- newline=t|f
- Should a newline be added after each
number parsed. This is often useful in cases nemoinp is used to generate
the independant coordinate when tables have to be generated from scratch.
[Default: t].
- nmax=integer
- Size of scratch array to be allocated dynamically
for the parsed number [default: 32768].
- tab=table_file
- Optional table output.
Default: none
- seed=initial_seed
- Seed for xrandom(3NEMO)
. Default: 0
- atof=
- Merely provided to test what natof returns. Note that this function does
not perform any error checking and can return the wrong number.
- dms=t|f
- Force parsing the (optionally comma separated) string(s) as D:M:S.S, converting
them to fractional degrees. For H:M:S parsing the user is responsible for
the extra factor of 15. Default: f.
The number of elements in an
array is limited, currently hardcoded to 32678 in nemoinp(3NEMO)
. If possible,
use seq(1)
.
seq(1)
, tabgen(1NEMO)
, tabmath(1NEMO)
, nemoinp(3NEMO)
,
getrange(3NEMO)
, functions(5NEMO)
nemoinp 4.2+3.1 simple math
nemoinp ’sqrt(2)’ math functions
nemoinp pi+3 some support for funny numbers
nemoinp 2:20:4 from 2 to 20 in steps of 4 (NEMO command)
seq 2 4 20 from 2 to 20 in steps of 4 (UNIX command)
set n=20 a (t)C-shell variable
n=20 a bash/zsh variable
nemoinp 2:${n}:4 as before, now using a shell variable
nemoinp 2::4 repeat the value 4 times
nemoinp ’10**[0:3:1]’ log spaced values 1 10 100 1000
nemoinp ’iflt(1,2,3,4)’ print 3, not 4, because 1 is less than 2
nemoinp 30:30:15 dms=t convert hexasegimal 30:30:15 into decimal
30.5043
nemoinp c,G,h,p,m a few good constants
nemoinp ’p*pi/(3600*180)’ 1 AU in km
Peter Teuben
18-apr-89 V1.0 created PJT
20-jun-89 V1.0a small changed - doc updated PJT
5-jul-89 V1.1 added nmax parameter PJT
18-may-92 documentation
16-jun-97 V1.6 %d forces integer math PJT
28-aug-00 V1.7 documented tab= and seed= PJT
31-may-01 V1.8 added atof= PJT
4-mar-03 V1.9 added dms= PJT
Table of Contents