[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
%.6g format not interpretted correctly
From: |
EXT-Germain, Marvin E |
Subject: |
%.6g format not interpretted correctly |
Date: |
Thu, 24 Sep 2009 12:15:14 -0700 |
%.6g format not interpretted correctly
This also affects the "print" statement's handling of numbers, since OFMT =
%.6g.
Test program compares .6g format to .6f and .6e. It should be the same as one
of them, but isn't.
Execute as:
echo howdy | awk -f testProgram
Gawk version 3.1.3
Red Hat Linux uname -r = 2.6.9-42.ELsmp
TEST PROGRAM:
{
A = 123.456789;
print "Value = 123.456789";
printf "Format = .6f ==> %.6f\n", A;
printf "Format = .6e ==> %.6e\n", A;
printf "Format = .6g ==> %.6g\n", A;
printf "\n";
A = 12.3456789;
print "Value = 12.3456789";
printf "Format = .6f ==> %.6f\n", A;
printf "Format = .6e ==> %.6e\n", A;
printf "Format = .6g ==> %.6g\n", A;
print 123.45678;
print OFMT;
}
OUTPUT:
Value = 123.456789
Format = .6f ==> 123.456789
Format = .6e ==> 1.234568e+02
Format = .6g ==> 123.457
Value = 12.3456789
Format = .6f ==> 12.345679
Format = .6e ==> 1.234568e+01
Format = .6g ==> 12.3457
- %.6g format not interpretted correctly,
EXT-Germain, Marvin E <=