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 > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
i cannot assign float point numbers to an array in solaris naree SUN Solaris 11 02-27-2008 04:06 AM
Extract numbers from a string and store in variables davewg Shell Programming and Scripting 6 11-14-2007 05:22 AM
adding float numbers strike Shell Programming and Scripting 5 08-29-2005 02:20 PM
problem with floating point numbers in awk kanagias Shell Programming and Scripting 7 06-24-2005 03:14 PM

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 03-05-2008
naree naree is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 81
can array store float point numbers

Hi all,

I have doubt can array in a shell script can store floating point numbers. i have tired. but i unable to work it out.

Please help me regarding this

Thank U
Naree
  #2 (permalink)  
Old 03-05-2008
jlliagre jlliagre is offline Forum Advisor  
ɹǝsn sıɹɐlosuǝdo
  
 

Join Date: Dec 2007
Location: Paris
Posts: 1,416
Code:
#!/bin/ksh

set -A a

for i in 1 2 3 4 5 6 7 8
do
  a[$i]=$(bc <<-%
  sc=6
  1 / $i
  %)
  printf "%d %f\n" $i ${a[$i]}
done
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 09:35 AM.


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