x = [1, 2, 3, 1e11]
y = x.collect { |xx| Math.sqrt xx }
xprecision = 3
yprecision = 5


open('sqrt.dat', 'w') do |f|
  x.zip(y) { |xx, yy| f.printf(, xprecision, xx, yprecision, yy) }
end


open('sqrt.dat', 'r') { |f| puts f.read }