The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Multiply variables Anita Flejter Shell Programming and Scripting 2 05-06-2008 04:03 PM
multiply variable fwabbly Shell Programming and Scripting 4 07-28-2007 02:26 PM
gawk multiply one field pau Shell Programming and Scripting 2 05-28-2006 10:01 AM
How to Convert scientific notation to normal ? maheshsri Shell Programming and Scripting 2 01-05-2006 10:33 AM
Easy UNIX notation question lavaghman UNIX for Dummies Questions & Answers 1 06-05-2002 12:20 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 01-26-2006
Registered User
 

Join Date: Jan 2006
Posts: 3
Arrow How to add/multiply numbers with scientific notation (2.343e-5)

Hi,
I'm need to do some addition and multiplication of scientific nottaion numbers, in the form 34.23423e-10 for example.

I was echoing the list of numbers to stdout, then using bc -l, then I find that this does not seem to work for numbers with exponential notation. Could someone help me out here? I want to do somethng like 'a - b*3=?' Thanks!
Reply With Quote
Forum Sponsor
  #2  
Old 01-26-2006
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,614
Well in ksh,

$ scicalc() { awk 'END { print '"$*"'}' < /dev/null ; return $? ; }
$ set -f
$ scicalc 3.2e2 + 1e3 * 3
3320
$

That "set -f" turns off globbing so the * is not expanded into a list of filenames.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:17 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0