Skip to main content
added 8 characters in body
Source Link
iruvar
  • 17k
  • 8
  • 51
  • 81

Most versions of awkawk have a printfprintf command. Instead of

print $1,s

print $1,s 

use

printf "%.4f %.4f\n",$1,s

printf "%.4f %.4f\n",$1,s 

and the outputs will be rounded to 4 decimal places. That way you won't see most rounding errors.

Most versions of awk have a printf command. Instead of

print $1,s

use

printf "%.4f %.4f\n",$1,s

and the outputs will be rounded to 4 decimal places. That way you won't see most rounding errors.

Most versions of awk have a printf command. Instead of

print $1,s 

use

printf "%.4f %.4f\n",$1,s 

and the outputs will be rounded to 4 decimal places. That way you won't see most rounding errors.

Source Link

Most versions of awk have a printf command. Instead of

print $1,s

use

printf "%.4f %.4f\n",$1,s

and the outputs will be rounded to 4 decimal places. That way you won't see most rounding errors.