help-gawk
[Top][All Lists]
Advanced

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

round to 0 or 5 at the 3 decimal place


From: Peng Yu
Subject: round to 0 or 5 at the 3 decimal place
Date: Fri, 4 Mar 2022 10:32:02 -0600

printf("%.3d", ...) rounds a number to the 3 decimal place. When the
number is less than 1, I want it to be rounded to the 3 decimal place
but the allowed number at that decimal place is only 0 or 5. I could
write some code based on conditional test to do this job. But
considering this might not be a very rare use case, is there an easy
way to do it?

-- 
Regards,
Peng



reply via email to

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