bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gawk] How to print the just enough number digits so the machine rep


From: Peng Yu
Subject: [bug-gawk] How to print the just enough number digits so the machine representation of the number does not change?
Date: Sun, 7 Oct 2012 22:39:30 -0500

Hi,

The following "print" command only print 6 digits. I do not want to
explicitly specify the number of digits. But I want to print just
enough number of digits (I think that it probably should be
0.3333333333333333148296) so that when the number is read back into
awk, it is still the same in the machine representation. I checked the
manual, but I don't see a way to do so. Does anybody know how to do
it? Thanks!

~/linux/test/awk/lang/function/print$ cat main.sh
#!/usr/bin/env bash

echo | awk 'BEGIN{print 1/3}'
~/linux/test/awk/lang/function/print$ ./main.sh
0.333333

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]