The UNIX and Linux Forums  


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
Floating point exception !!! ssk01 Linux 3 12-24-2008 02:20 PM
Floating point error in C Hara High Level Programming 2 06-18-2008 06:43 AM
Rounding off the value of Floating point value damansingh Shell Programming and Scripting 7 05-21-2008 10:46 AM
Floating Division in Linux Dastard Shell Programming and Scripting 3 04-16-2008 01:57 PM
floating point addition ravi raj kumar Shell Programming and Scripting 8 12-22-2006 02:47 AM

Closed Thread
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
  #1 (permalink)  
Old 07-25-2002
gsatch gsatch is offline
Registered User
  
 

Join Date: Jun 2002
Location: Irvine, CA
Posts: 21
Floating Point Division

Does anyone have a simple way of doing floating point ("fp") division? For example, if I divide 3 by 5, I can get 0.6. The built-in calc (`bc`) will perform fp multiplication, but not division, at least not straight-up (i.e., starting bc and just typing in 3/5).

I am trying to do this using KSH on HP-UX 11.0 or Solaris 8.

Any help will be GREATLY appreciated (have already spent more time that I want to admit to trying to find a simple solution).

Thank you!
  #2 (permalink)  
Old 07-25-2002
gsatch gsatch is offline
Registered User
  
 

Join Date: Jun 2002
Location: Irvine, CA
Posts: 21
BREAKTHRU!! Duh GSATCH, use "scale" option in `bc` - `echo "scale=2;2/3" |bc` returns ".66".

Ok, my brain is back in place now...
Closed Thread

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:54 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