RosettaCodeData/Task/Write-float-arrays-to-a-text-file/F-Sharp/write-float-arrays-to-a-text-file.fs
2023-07-01 13:44:08 -04:00

12 lines
328 B
FSharp

[<EntryPoint>]
let main argv =
let x = [ 1.; 2.; 3.; 1e11 ]
let y = List.map System.Math.Sqrt x
let xprecision = 3
let yprecision = 5
use file = System.IO.File.CreateText("float.dat")
let line = sprintf "%.*g\t%.*g"
List.iter2 (fun x y -> file.WriteLine (line xprecision x yprecision y)) x y
0