10.06.2016 Views

eldo_user

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Eldo Control Language<br />

Library of Functions for Tasks<br />

• ARG<br />

Optional. An argument of the corresponding type must be specified for each format tag<br />

present in the FORMAT argument.<br />

Examples<br />

Example:<br />

set t[] = 0<br />

set y[] = 0<br />

set s = ""<br />

set i = 0<br />

t[0] = -1<br />

y[0] = 0<br />

t[1] = 0<br />

y[1] = 1.578<br />

t[2] = 1<br />

y[2] = 15.71<br />

t[3] = 10<br />

y[3] = 203.8<br />

s = sprint("(% 3d;%12.4e)\n\<br />

(% 3d;%12.4e)\n\<br />

(% 3d;%12.4e)\n\<br />

(% 3d;%12.4e)\n",\<br />

t[0], y[0], t[1], y[1], t[2], y[2], t[3], y[3])<br />

fprint(stdout, "%s", s)<br />

The output of the previous example is:<br />

( -1; 0.000e+00)<br />

( 0; 1.578e+00)<br />

( 1; 1.571e+01)<br />

( 10; 2.038e+02)<br />

Ensure you provide adequate precision for the %f output format, or use the %e, %E, %g, or %G<br />

format. For example, if the variable to be printed is smaller than 1e-6, it cannot be represented<br />

with the %f format without changing the precision:<br />

set myvar=1n<br />

fprint(stdout, "Result %s: %f\n", "%f", myvar)<br />

fprint(stdout, "Result %s: %.9f\n", "%.9f", myvar)<br />

fprint(stdout, "Result %s: %e\n", "%e", myvar)<br />

will output:<br />

Result %f: 0.000000<br />

Result %.9f: 0.000000001<br />

Result %e: 1.000000e-09<br />

Related Topics<br />

Library of Functions for Tasks<br />

fprint<br />

962<br />

Eldo® User's Manual, 15.3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!