precision for floating number fails after 15th decimal
Bug #1805003 reported by
kenn
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gawk (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
I noticed that gawk floating number calculator function (mpfr_atan2) prints wrong numbers after 15th decimal.
The following gawk command prints pi:
`awk 'BEGIN { x = 1; y = 1; result = 4*atan2 (y,x); printf " %.20f degrees\n", result}'`
`3.141592653589
But it must be `3.141592653589
To post a comment you must log in.
It's not a bug, precision value must be set in the follwing way:
awk -M -v PREC=10000 'BEGIN { x = 1; y = 1; result = 4*atan2 (y,x); printf " %.50f\n", result}'