- Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Sponsored Links

Latest News
  General News
  Press Releases
  Off Topic

Back to files


a GTK 2 based scientific calculator

For installation information see the INSTALL file. For a list of shortcuts, see doc/shortcuts There is a short man page (man galculator) Information on Formula Entry mode can be found below. In general, galculator's homepage is the most reliable and up2date source of information.

RPMs: a spec file is included (galculator.spec). Thanks to Victor. Or download at (thanks to Dag Wieers) DEBs: galculator is in DEBIAN/unstable. Thanks to seb128.

Formula Entry Mode

Since version 1.2.0 galculator features a formula entry mode. This mode is one more step towards a calculator accepting input as written on the paper. galculator's formula entry mode aims to provide all the features of the algebraic mode (and even to go beyond ...).

This part of galculator is developed actively. This section gives an overview of the functions currently implemented and points out some restrictions.

Formula entry mode accepts decimal numbers as input as well as hexadecimal, binary and octal numbers. The latter three have to be entered with a prefix:

Number base     Prefix(es)      Example
decimal         none            -3.1415
hexadecimal     0x or 0h        0xAF
binary          0b              0b1001
octal           0o              0o777

All algebraic operations and functions of the algebraic mode are supported. The following table lists all available operations:

Operation                       identifier      
+, -, *, /                      +, -, *, /
percent x%y (x percent of y)    %
power x^y                       ^
module (MOD)                    mod, MOD
left shift (LSH)                <<
right shift (INV + LSH)         >>
AND                             &, and, AND
OR                              |, or, OR
XOR                             xor, XOR

Let's speak of factorial and complement as functions. Most functions' argument has to be enclosed by brackets. Therefore sin 3 is not allowed and has to be written as sin(3). User defined functions can be used in formula entry mode without any restrictions!

Function Function identifier Example Trigonometric functions:

Sine, Cosine, Tangent           sin, cos, tan           sin(0.5)
their inverse                   asin, acos, atan        asin(0.5)
their hyperbolic variants       sinh, cosh, tanh        sinh(0.5)
and the inverse of those        asinh, acosh, atanh     asinh(0.5)
natural logarithm (base e)      ln                      ln(3)
logarithm (base 10)             log                     log(3)
square root                     sqrt                    sqrt(3)
factorial                       !                       (3)!, 3! brackets are 
complement                      ~                       ~(3) brackets are 

If formula entry mode's parser encounters an (syntax) error, the formula entry text is turned red.

User defined functions

Since version 1.2.1 galculator also features user defined functions. They can be called with the fun button next to the constant button and work like the other function buttons like sin, cos, etc. (except that inverse and hyperbolic are not supported). User functions can be defined in the Preferences dialog (Functions page). The function name can be any string beginning with a letter. So far, only a single variable is allowed. Expression gives the string expression of the function with respect to the specified variable:

Function                Name    Variable        Expression
f(x)=1-x                f       x               1-x

User defined functions can depend on other user functions:

Function                Name    Variable        Expression
g(x)=1/(1-x)=1/f(x)     g       x               1/f(x)

User functions can also be called from formula entry mode.

Some random notes

Left shifting is done with the LSH button. 3 << 4 "shift 3 four times to the left" 3 LSH 4 = As a right shift is somehow the inverse of a left shift, right shifting is done by first activating INV and than clicking the LSH button:

23 >> 5 "shift 23 five times to the right" 23 INV LSH 5

You can change number base, angle base and the notation mode by simply clicking on the corresponding module in the display's second line. If changing from e.g. decimal number base to binary mode results in an "inf" value on the display, the initial value was too big. Due to the limited display length every mode has its own limits:

decimal         IEEE floating point numbers
hexadecimal     -2147483648 .. 2147483647 (0h80000000 .. 0h7FFFFFFF)
octal           -34359738368 .. 34359738367 (0o400000000000 .. 0o377777777777)
decimal         -32768 .. 32767 (0b1000000000000000 .. 0b111111111111111)

If computing in hexadecimal, octal or binary mode, inf means that an overflow has happened.

If in hexadecimal, octal or binary signed mode, a negative number won't be represented with a leading minus but as 2's complement with respect to the chosen variable length.

It is not possible to close unwanted braces straightforward. 1+((()) won't reduce the stack of open braces, there will remain three open braces. It is difficult to tell a "compute as soon as possible" calculator what an empty pair of braces means: in 1+() the empty braces mean 0 (1+0=1) but in 1() the empty braces mean 1 (11=1). Therefore you have to enter a corresponding number in order to close braces at the moment, e.g. 1+((0)) will do.

The percent operation works as "x percent of y". So if there is 37 on the display and you press the percent button and enter 123, you get as result 37% of 123.

If you press the [EE] button the display will never become 0e+ but 1e+ instead.

There is a simple plausibility check for the character choosen as thousand's separator: it must not be a number in the configured number base and for a decimal number base neither decimal point nor "e" (exponent identifier string) nor "-" (minus).


simon floery (

Sponsored Links

Discussion Groups
  Networking / Security

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 All rights reserved.