--Hi,Have you tried coding constants as strings, which will be converted to f.p. by gawk|tawk|mawk|awk?
TAWK (v6.7) display warning with more than 14 digits:
awkw "BEGIN{var=1.9224832057952844;printf("%.8f",var);exit}"
awk: warning in program line 1: floating point: too many significant digits 1.92248321
--Hi,
TAWK (v6.7) display warning with more than 14 digits:
awkw "BEGIN{var=1.9224832057952844;printf("%.8f",var);exit}"
awk: warning in program line 1: floating point: too many significant digits 1.92248321
On Thursday, 7 October 2021 at 08:24:13 UTC-4, manch...@gmail.com wrote:
--Hi,
TAWK (v6.7) display warning with more than 14 digits:
awkw "BEGIN{var=1.9224832057952844;printf("%.8f",var);exit}"Have you tried coding constants as strings, which will be converted to f.p. by gawk|tawk|mawk|awk?
awk: warning in program line 1: floating point: too many significant digits
1.92248321
pi_str="3.14159265358979323846264338327950288419716939937510"; # 50 decimal digits
var="1.9224832057952844"; # ???
I do not know anything about TAWK beyond Ver 5, which was 32-bit, but I don't remember any warning such as you got.
Maybe consider switching to one of the *awk's that are up-to-date?
On 07.10.2021 14:24, Laurent MANCHON wrote:
--Hi,
TAWK (v6.7) display warning with more than 14 digits:
awkw "BEGIN{var=1.9224832057952844;printf("%.8f",var);exit}"And what is your question or problem? Or do you just want to inform us
awk: warning in program line 1: floating point: too many significant digits
1.92248321
about that nice and useful tawk feature to get a warning?
Janis
PS: Don't top-post!
Le vendredi 8 octobre 2021 à 09:02:46 UTC+2, Janis Papanagnou a écrit :
On 07.10.2021 14:24, Laurent MANCHON wrote:
--Hi,And what is your question or problem? Or do you just want to inform us
TAWK (v6.7) display warning with more than 14 digits:
awkw "BEGIN{var=1.9224832057952844;printf("%.8f",var);exit}"
awk: warning in program line 1: floating point: too many significant digits
1.92248321
about that nice and useful tawk feature to get a warning?
just to say: Why this warning message ?
when you have a file with millions of big floating numbers, TAWK print
this message !
Is there an option or parameter to avoid this warning ?
Le vendredi 8 octobre 2021 à 11:40:27 UTC+2, Ben Bacarisse a écrit :
Does it happen when processing input? If so, I can see how it would be
very annoying.
yes, try to put this list of numbers in a file and try to print them: 1.941359281539914
1.965880632400514
[...]
Le vendredi 8 octobre 2021 à 09:02:46 UTC+2, Janis Papanagnou a écrit :
On 07.10.2021 14:24, Laurent MANCHON wrote:
--Hi,And what is your question or problem? Or do you just want to inform us
TAWK (v6.7) display warning with more than 14 digits:
awkw "BEGIN{var=1.9224832057952844;printf("%.8f",var);exit}"
awk: warning in program line 1: floating point: too many significant digits >>> 1.92248321
about that nice and useful tawk feature to get a warning?
Janis
PS: Don't top-post!
just to say: Why this warning message ?
when you have a file with millions of big floating numbers, TAWK print this message !
Is there an option or parameter to avoid this warning ?
Laurent MANCHON <manch...@gmail.com> writes:
Le vendredi 8 octobre 2021 à 09:02:46 UTC+2, Janis Papanagnou a écrit :Does it happen when processing input? If so, I can see how it would be
On 07.10.2021 14:24, Laurent MANCHON wrote:just to say: Why this warning message ?
--Hi,And what is your question or problem? Or do you just want to inform us
TAWK (v6.7) display warning with more than 14 digits:
awkw "BEGIN{var=1.9224832057952844;printf("%.8f",var);exit}"
awk: warning in program line 1: floating point: too many significant digits
1.92248321
about that nice and useful tawk feature to get a warning?
when you have a file with millions of big floating numbers, TAWK print this message !
very annoying.
Is there an option or parameter to avoid this warning ?I don't know much about tawk, but I do know it's old an unmaintained.
Are you committed to using that version of awk? If not, this warning
could be the prompt you need to switch to a maintained version...
--
Ben.
On 08.10.2021 11:45, Laurent MANCHON wrote:
Le vendredi 8 octobre 2021 à 11:40:27 UTC+2, Ben Bacarisse a écrit :
Does it happen when processing input? If so, I can see how it would be
very annoying.
yes, try to put this list of numbers in a file and try to print them: 1.941359281539914
1.965880632400514
[...]
On which platform are you working? If you are on some Unix system I'd
try
1) redirecting stderr (hoping the warning message uses that channel)
tawk '...' a_file 2>/dev/null
2) stripping the input data to the supported accuracy, say, using a
string length of only 8
cut -c -8 < a_file | tawk '...'
3) using (as suggested by Ben) another Awk (here GNU Awk)
gawk '...' a_file
Janis
--Hi,
TAWK (v6.7) display warning with more than 14 digits:
awkw "BEGIN{var=1.9224832057952844;printf("%.8f",var);exit}"
awk: warning in program line 1: floating point: too many significant digits 1.92248321
I got around the problem as suggested by using: $1=substr($1,1,10)
Le vendredi 8 octobre 2021 à 12:03:23 UTC+2, Janis Papanagnou a écrit :
On 08.10.2021 11:45, Laurent MANCHON wrote:
Le vendredi 8 octobre 2021 à 11:40:27 UTC+2, Ben Bacarisse a écrit :
Does it happen when processing input? If so, I can see how it would be >> very annoying.
yes, try to put this list of numbers in a file and try to print them: 1.941359281539914
1.965880632400514
[...]
On which platform are you working? If you are on some Unix system I'd
try
1) redirecting stderr (hoping the warning message uses that channel)
tawk '...' a_file 2>/dev/null
2) stripping the input data to the supported accuracy, say, using a
string length of only 8
cut -c -8 < a_file | tawk '...'
3) using (as suggested by Ben) another Awk (here GNU Awk)
gawk '...' a_file
If you are VERY particular, consider d11=substr($1,11,1), examine it and decide if you need to round up, then possibly add 1, such as: d10=substr($1,10,1)+(d11>4); THEN $1=substr($1,1,9) d10;Janisi work on windows
I got around the problem as suggested by using: $1=substr($1,1,10)
Le vendredi 8 octobre 2021 à 09:02:46 UTC+2, Janis Papanagnou a écrit :
On 07.10.2021 14:24, Laurent MANCHON wrote:
--Hi,
TAWK (v6.7) display warning with more than 14 digits:
awkw "BEGIN{var=1.9224832057952844;printf("%.8f",var);exit}"And what is your question or problem? Or do you just want to inform us about that nice and useful tawk feature to get a warning?
awk: warning in program line 1: floating point: too many significant digits
1.92248321
Janis
PS: Don't top-post!just to say: Why this warning message ?
when you have a file with millions of big floating numbers, TAWK print this message !
Is there an option or parameter to avoid this warning ?
1.92248321
Le vendredi 8 octobre 2021 à 09:02:46 UTC+2, Janis Papanagnou a écrit :
On 07.10.2021 14:24, Laurent MANCHON wrote:
--Hi,
TAWK (v6.7) display warning with more than 14 digits:
awkw "BEGIN{var=1.9224832057952844;printf("%.8f",var);exit}"And what is your question or problem? Or do you just want to inform us about that nice and useful tawk feature to get a warning?
awk: warning in program line 1: floating point: too many significant digits
1.92248321
Janis
You can turn off the "too many significant digits" message with the FLOATMASK variable only for a *string* being converted to a float, see TAWK 5 manual page 200:PS: Don't top-post!just to say: Why this warning message ?
when you have a file with millions of big floating numbers, TAWK print this message !
Is there an option or parameter to avoid this warning ?
BEGIN {
FLOATMASK = and(FLOATMASK,not(0x400))
var = "1.9224832057952844"
printf("%.8f",var)
}
1.92248321
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 22:34:55 |
Calls: | 6,646 |
Calls today: | 1 |
Files: | 12,191 |
Messages: | 5,327,553 |