Write float arrays to a text file: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 1,014:
 
io.close( fp )</syntaxhighlight>
 
=={{header|M2000 Interpreter}}==
Precision here is just Round (as school rounding)
Print round(2.5,0)=3
Print round(1.5,0)=2
Print round(-2.5,0)=-3
Print round(-1.5,0)=-2
 
 
<syntaxhighlight lang="m2000 interpreter">
Module Test1 (filename$, x, xprecision, y, yprecision) {
locale 1033 // set decimal point symbol to "."
// using: for wide output // for UTF16LE
// here we use ANSI (8bit per character)
open filename$ for output as #f
for i=0 to len(x)-1
print #f, format$("{0} {1}", round(x#val(i),xprecision-1), round(y#val(i), yprecision-1))
next
close #f
win "notepad", dir$+filename$
}
Test1 "OutFloat.num", (1, 2, 3, 1.e11),3, (1, 1.4142135623730951, 1.7320508075688772, 316227.76601683791), 5
</syntaxhighlight>
{{out}}
<pre>1 1
2 1.4142
3 1.7321
100000000000 316227.766</pre>
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
404

edits