[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gawk uses default OFMT with sprintf("%s", ...) and when concatenating st
From: |
Christer Lundberg |
Subject: |
gawk uses default OFMT with sprintf("%s", ...) and when concatenating strings |
Date: |
Mon, 30 Aug 2010 18:57:13 +0000 (GMT) |
Version: gawk 3.1.7 (Fedora package gawk-3.1.7-3.fc12.i686)
Sample program:
BEGIN{ OFMT="%.8g"
x = 1/7
print "print with a comma :", x
print "concatenated to a string: " x
print "using sprintf and %s :", sprintf("%s",x)
}
Output with my system:
print with a comma : 0.14285714
concatenated to a string: 0.142857
using sprintf and %s : 0.142857
Expected output:
Would expect eight decimals on each one of the three rows.
Remark:
First time I experience something that appears like a bug in this indispensable
piece of software!
Best regards,
Christer Lundberg
- gawk uses default OFMT with sprintf("%s", ...) and when concatenating strings,
Christer Lundberg <=