![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Floating point error in C | Hara | High Level Programming | 2 | 06-18-2008 02:43 AM |
| Floating point exception !!! | ssk01 | Linux | 2 | 05-14-2008 02:58 AM |
| floating point problem | vijlak | High Level Programming | 4 | 03-08-2007 12:18 AM |
| floating point addition | ravi raj kumar | Shell Programming and Scripting | 8 | 12-21-2006 10:47 PM |
| Floating Point Division | gsatch | Shell Programming and Scripting | 1 | 07-25-2002 01:03 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Rounding off the value of Floating point value
Hello,
i have some variables say: x=1.4 y=3.7 I wish to round off these values to : x = 2 (after rounding off) y = 4 (after rounding off) I am stuck. Please help. |
| Forum Sponsor | ||
|
|
|
|||
|
Hi aju_kup,
Thanks for replying. typeset -i var var=100.500 echo $var When i try your suggestion, it gives me an error which is: check4.sh: line 2: 100.500: syntax error in expression (error token is ".500") here check4.sh is the file which contained your suggested code. I am working on KShell. Please see to it. Thanks |
|
|||
|
Sure friend,
rowCountEntered=98 totalRowCount=1000 numberOfFilesGenerated=`echo $totalRowCount $rowCountEntered | awk '{print $1/$2}'` echo $numberOfFilesGenerated 10.20 Instead of 10.20, i want the variable numberOfFilesGenerated should return 11. In Anticipation. |