LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 02-12-2005, 06:28 PM   #1
Starch
Member
 
Registered: Jan 2005
Posts: 77

Rep: Reputation: 15
I need a calculator


Is there a good calculator on linux. I need one that I can enter a formula and execute it and get back a result in hex, binary, decimal. I like this calculator but its for windows. compiling a C program is great but it takes too long for something like 1+1 because it needs to be compiled.

Thanks in advance!
 
Old 02-12-2005, 06:58 PM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Hi.

kcalc can do what you're looking for.

Dave
 
Old 02-12-2005, 07:09 PM   #3
Starch
Member
 
Registered: Jan 2005
Posts: 77

Original Poster
Rep: Reputation: 15
Nice calculator, is there anyway to show everything I typed? instead of just the answer or what I am currently typing in.

Thanks in advance!
 
Old 02-12-2005, 07:25 PM   #4
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Not really.

There is a command line utility called 'dc' which might suit you...
For example, to do 2+5, and have the result in base 16 (Hex), you would do:
dc <return>
16 <return>
o <return> (that's a letter o, not a zero)
2 <return>
5 <return>
+ <return>
p <return>

The only problem is that dc can only do simple math (+-*/^ and such). It does, though have the advantage that you can echo a stream of commands to it, and get the result that way, so it can be scripted.

'bc' is more powerful than 'dc', and can apparently do cos and sin etc, but I haven't had any reason to use it over 'dc' yet, so I don't know its syntax. Have a look at 'man bc' if you need a more powerful calculator, and don't mind the command line.

xcalc, and kcalc are the only GUI calculators I have come accross on Linux.

Dave
 
Old 02-14-2005, 12:38 PM   #5
perfect_circle
Senior Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 53
Quote:
Originally posted by Starch
Nice calculator, is there anyway to show everything I typed? instead of just the answer or what I am currently typing in.

Thanks in advance!
You may try mathomatic:
http://www.linuxpackages.net/search_...matic&ver=10.0
 
Old 02-14-2005, 06:06 PM   #6
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Posts: 952

Rep: Reputation: 217Reputation: 217Reputation: 217
First off.
javascript:eval() in the address bar will do the AnalogX example in decimal.

On the same note, you should be able to eval any expression, then convert to all common bases decimal using javascript functions (beware of base 10 numbers with high order zeros being taken as octal and throwing out errors) and then write a reasonable html based (it's free) look alike.

I wrote this function to work in a "NumConv" type utility modeled after my old CASIO PV organiser.
*******
function makeString(MyNum, Radix) {
MyDiv=MyNum ;
MyString="" ;
MyChar="" ;
MyRem = 0 ;
while (MyDiv != 0) {
MyRem=MyDiv%Radix ;
if (MyRem < 10) MyChar=MyRem.toString() ;
if (MyRem == 15) MyChar = "F" ;
if (MyRem == 14) MyChar = "E" ;
if (MyRem == 13) MyChar = "D" ;
if (MyRem == 12) MyChar = "C" ;
if (MyRem == 11) MyChar = "B" ;
if (MyRem == 10) MyChar = "A" ;
MyString=MyChar+MyString ;
MyDiv=(MyDiv-MyRem) / Radix ;
}
// alert("In Make:" + MyNum.toString() + ":" + MyString) ;
return MyString ;
}
********
Tested for radix = 2, 8, 16 and thre calls will give you most common bases.

End
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
C Calculator ChrisRain Programming 13 03-27-2007 02:33 AM
shell calculator DropSig Linux - Newbie 3 11-01-2004 09:18 PM
A Calculator......... 320mb Programming 0 08-13-2004 04:55 PM
TI calculator adam_boz Linux - General 1 08-22-2002 10:15 AM
Calculator KyleYankan Linux - Software 6 08-03-2002 01:08 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration