Hi!
I am trying to make a program, for which I need high precision. My problem is that I do not understand how AWK is working, I mean:
echo 1.00001E-6 | awk -v FS=" " -v D=0 'D=D+$1 {printf("%.12g\n",D)}'
1.00001e-06
(I obtain this result from %.06g to %.17g)
but:
echo 1.00001E-6 | awk -v FS=" " -v D=0 'D=D+$1 {printf("%.18g\n",D)}'
1.00001000000000002e-06
??????
and these numbers can change my results.
thankx in advance
sergio
I am trying to make a program, for which I need high precision. My problem is that I do not understand how AWK is working, I mean:
echo 1.00001E-6 | awk -v FS=" " -v D=0 'D=D+$1 {printf("%.12g\n",D)}'
1.00001e-06
(I obtain this result from %.06g to %.17g)
but:
echo 1.00001E-6 | awk -v FS=" " -v D=0 'D=D+$1 {printf("%.18g\n",D)}'
1.00001000000000002e-06
??????
and these numbers can change my results.
thankx in advance
sergio