The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem in division rochitsharma UNIX for Dummies Questions & Answers 9 11-25-2008 10:17 PM
display the result of wc -l with words before and after the result melanie_pfefer UNIX for Dummies Questions & Answers 3 04-30-2008 07:33 AM
Outputting formatted Result log file from old 30000 lines result log<help required> vikas.iet Shell Programming and Scripting 5 12-02-2007 10:43 PM
Cannot adjust division jav_v Filesystems, Disks and Memory 1 08-20-2002 08:50 AM
division problem inquirer Shell Programming and Scripting 3 04-02-2002 10:03 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 01-23-2008
user_prady user_prady is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 163
how to get exact result in my division

Hello Friends,


Why I am not getting exact result in the following division. It is rounding off automatically. Is there any way to get the exact result or
can be set by user to get how many digits to carry after the decimal.

Code:
gawk '{

  wait_ns1 = (82290 +1 )/78  # actuall result = 1055.012821
  wait_ns2 = (82320 +1 )/78  # actuall result = 1055.397436
  wait_ns3 = (82350 +1 )/78  # actuall result = 1055.782051

  print wait_ns1;
  print wait_ns2;
  print wait_ns3;

} ' my_file
output:
Code:
1055.01
1055.4
1055.78

Or How to get the actuall result ,ie,
Code:
1055.012821
1055.397436
1055.782051
Thanks in advance..
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:33 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0