RosettaCodeData/Task/Write-float-arrays-to-a-tex.../BBC-BASIC/write-float-arrays-to-a-tex...

22 lines
498 B
Plaintext

DIM x(3), y(3)
x() = 1, 2, 3, 1E11
FOR i% = 0 TO 3
y(i%) = SQR(x(i%))
NEXT
xprecision = 3
yprecision = 5
outfile% = OPENOUT("filename.txt")
IF outfile%=0 ERROR 100, "Could not create file"
FOR i% = 0 TO 3
@% = &1000000 + (xprecision << 8)
a$ = STR$(x(i%)) + CHR$(9)
@% = &1000000 + (yprecision << 8)
a$ += STR$(y(i%))
PRINT #outfile%, a$ : BPUT #outfile%, 10
NEXT
CLOSE #outfile%