Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bc command

Status
Not open for further replies.

mksmith02

Technical User
Jul 8, 2003
3
US
Using the bc command. Is there a way to convert scientific value to a decimal value? For example, convert 511.e+3 to 511000.
 
You could do what it does logically

bc
e=10
511*e^3
511000

or in a script

VAL=`echo "511.e+3" | sed 's/e/*e/g' | sed 's/+/^/g'`
bc << !EOF
e=10
$VAL
!EOF


 
another script option, using ksh93:

Code:
typeset -E val=511.e+3

echo $val


FREE BONUS TIP:

ksh93 became available with 5L versions of AIX, but in 4.3 (and possibly earlier) versions the Desktop Kornshell (/usr/dt/bin/dtksh) is a modified ksh93 shell that does not require CDE to run.

Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L

 
Hello Rodknowlton,

Could you please sepcify the Call Number or url for this book which you listed above:

IBM Certified Advanced Technical Expert pSeries and AIX 5L
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top