Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
 Home Forums HCL Reviews Tutorials Articles Register Search Today's Posts Mark Forums Read
 LinuxQuestions.org root square / two solutions - one variable
 Programming This forum is for all programming questions. The question does not have to be directly related to Linux and any language is fair game.

Notices

 08-28-2003, 06:27 AM #1 Dimitris LQ Newbie   Registered: Aug 2003 Posts: 13 Rep: root square / two solutions - one variable Hello, I have two questions : 1) I put the square in a variable x when it gets solved it echos the result x=-1+1 for example How can I make it show them in two different variables ? 2) I make it solve a simple equation with random numbers. Most of times the result is decimal but it shows it as an integer. How to make that variable to hold decimals too ? I guess It's very simple but I couldn't find it in some manuals I have. Thanks alot for your help! Have a nice day,
 08-28-2003, 06:38 AM #2 kev82 Senior Member   Registered: Apr 2003 Location: Lancaster, England Distribution: Debian Etch, OS X 10.4 Posts: 1,263 Rep: can you post your code or make it clearer what your trying to do
08-28-2003, 07:11 AM   #3
Hko
Senior Member

Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep:
Re: root square / two solutions - one variable

Quote:
 Originally posted by Dimitris How to make that variable to hold decimals too ? I guess It's very simple but I couldn't find it in some manuals I have.

 08-28-2003, 07:45 AM #4 Dimitris LQ Newbie   Registered: Aug 2003 Posts: 13 Original Poster Rep: 2)It's bash scripting.... I can use double ? 1) I mean a sqrt(4) gives two results. -2+2 . The result get's in one variable. I want each in a variable not both in one Thanks
 08-28-2003, 02:39 PM #5 Dimitris LQ Newbie   Registered: Aug 2003 Posts: 13 Original Poster Rep: Could somebody help please ?
 08-28-2003, 02:47 PM #6 david_ross Moderator   Registered: Mar 2003 Location: Scotland Distribution: Slackware, RedHat, Debian Posts: 12,047 Rep: Try this (where \$SQRT is the complete variable) one=`echo \$SQRT | cut -d"+" -f 1` two=`echo \$SQRT | cut -d"+" -f 2`

 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 Off HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Spooky Linux - Games 1 05-14-2005 02:14 PM linuxceptic Linux - Wireless Networking 3 02-04-2004 07:23 PM d4d4n9 Mandriva 11 12-28-2003 07:44 AM Huddlebum Linux - General 3 11-16-2003 08:33 PM Dimitris Programming 4 09-02-2003 10:05 PM

LinuxQuestions.org

All times are GMT -5. The time now is 12:08 PM.

 Contact Us - Advertising Info - Rules - LQ Merchandise - Donations - Contributing Member - LQ Sitemap -