f



Nor forcing locale's usage, MPRF behaviors diffrently ?

Hi,
I understand when activating MPFR library, I have to force the use of the l=
ocale=E2=80=99s decimal point character when parsing numeric input data :

$ gawk -N '{ printf("$1 =3D %f\n",$1); printf("$2 =3D %d\n",$2); printf("%f=
\n", $1^$2) }'
2.5 2
$1 =3D 2,000000
$2 =3D 2
4,000000
2,5 2
$1 =3D 2,500000
$2 =3D 2
6,250000

$ gawk -M -N '{ printf("$1 =3D %f\n",$1); printf("$2 =3D %d\n",$2); printf(=
"%f\n", $1^$2) }'
2.5 2
$1 =3D 2,000000
$2 =3D 2
4,000000
2,5 2
$1 =3D 2,500000
$2 =3D 2
6,250000

What I don't understand, is why when not forcing using locale, I don't have=
 the same behavior between the two following awk commands :

$ gawk '{ printf("$1 =3D %f\n",$1); printf("$2 =3D %d\n",$2); printf("%f\n"=
, $1^$2) }'
2.5 2
$1 =3D 2.500000
$2 =3D 2
6.250000
2,5 2
$1 =3D 2.000000
$2 =3D 2
4.000000

$ gawk -M '{ printf("$1 =3D %f\n",$1); printf("$2 =3D %d\n",$2); printf("%f=
\n", $1^$2) }'
2.5 2
$1 =3D 2.000000
$2 =3D 2
4.000000
2,5 2
$1 =3D 2.000000
$2 =3D 2
4.000000

$ awk --version | head -1
GNU Awk 4.1.4, API: 1.1 (GNU MPFR 3.1.4, GNU MP 6.1.0

Thanks
0
Olivier
11/22/2016 2:45:12 PM
comp.lang.awk 3450 articles. 0 followers. Post Follow

0 Replies
287 Views

Similar Articles

[PageSpeed] 26

Reply: