bug-gawk
[Top][All Lists]
Advanced

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

How are numbers printed in gawk?


From: Peng Yu
Subject: How are numbers printed in gawk?
Date: Wed, 18 Mar 2020 01:26:01 -0500

Hi,

I'd like to write some python code that produces the same results as
gawk for numbers. As far as I understand there is no integer type in
gawk internal. But if I use float in python for integer, python will
print something like 1.0. Therefore, I'd like to know gawk is
implemented regarding numbers. Could anybody show the best approach to
implement the same method used in awk dealing with numbers in python?
Thanks.

$ awk 'BEGIN { print .0 + 1 }'
1
$ python -c 'print(.0 + 1)'
1.0

-- 
Regards,
Peng



reply via email to

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