|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
![]() |
|
|
Search this Thread |
|
#1
|
|||
|
|||
|
Rounding a decimal
Hi,
I am currently using tcsh I am trying to round a decimal number to the ten-thousandths place For instance: 1.23456 is rounded up towards 1.2346 I am not looking for truncation, but for rounding. Anyone know how to do this with awk or expr? Thanks |
| Sponsored Links | ||
|
|
|
#2
|
|||
|
|||
|
printf will do that.
man printf |
|
#3
|
||||
|
||||
|
Code:
$ printf "%.4f\n" 1.23456 1.2346 $ |
| Sponsored Links | ||
|
|
![]() |
| Tags |
| awk, decimal, expr, rounding, tcsh |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Rounding Script Help | kingrj46 | Shell Programming and Scripting | 4 | 11-27-2009 10:28 AM |
| Rounding Script Help | kingrj46 | Linux | 0 | 11-26-2009 02:33 PM |
| Rounding numbers down | dcfargo | UNIX for Dummies Questions & Answers | 5 | 09-16-2008 07:14 PM |
| Rounding off using BC. | noodlesoup | Shell Programming and Scripting | 3 | 09-11-2006 12:38 AM |
| Round off decimal number to 2 decimal places? | Vozx | Shell Programming and Scripting | 1 | 12-07-2005 09:53 PM |