ralcalc version 1.4.2
What is ralcalc?
ralcalc is a simple command line calculator designed to take a single line input and produce a result. I also have it installed as the "=" command for even quicker access.
2*9 = 18
Both the input and output make use of SI prefixes (see http://en.wikipedia.org/wiki/SI_prefix) for easier input and reading of results. Only the common engineering prefixes that are powers a multiple of three are used, so G, M, k, m, u, n, etc.
Numbers of the style 1e-3 are also supported for input.
Version information can be shown with:
See also the man page:
- Gentoo ebuild
- openSUSE 11.1, 11.0 (these are package repository urls, add them to yast then search for "ralcalc" in the package manager)
Operators, Functions and Constants
- + Addition
- - Subtraction
- * x Multiplication (the 'x' is for use when shell expansion may be a problem)
- / Division
- ^ Power
-  Brackets - increase the precedence of anything within the brackets.
- _ The result of the last ralcalc run (stored in $HOME/.ralcalc_result)
- log The base 10 logarithm.
- ln The natural logarithm.
- sin, cos, tan, asin, acos, atan
- pi (3.14159)
- exp (2.71828)
2^.5 = 1.41421
1/_ = 707.107m
Anything within brackets  or () is processed first. Within brackets, the order or precedence is ^, * /, + -.
Bugs / Requests
Either contact me directly (see the bottom of the page), or else head to launchpad to submit a new bug report or see existing ones.
- Added -p option to control output precision for -r and -e modes.
- Fix inconsistent output for SI prefixes smaller than m.
- Turkish translations thanks to Angel Spy and Devrim Şahin.
- Updated Czech translations thanks to Kuvaly [LCT].
- Partial Basque man page translations thanks to Mikel Alzibar and gorkaazk.
- Partial French man page translations thanks to Pierre Rudloff.
- Partial Italian man page translations thanks to Guybrush88.
- Updated Hebrew translations.
- Occitan translations thanks to Cédric Valmary.
- Vietnamese translations thanks to Nguyen Quang Chien.
- Complete Dutch translations thanks to Yentl.
- Complete Italian translations thanks to Lorenzo Baracchi.
- Completed French translations thanks to Michel Boisset.
- Partial Czech translations thanks to Kuvaly.
- Partial Frisian translations thanks to Wanda Nauta.
- Partial Norwegian Bokmal translations thanks to Sigurd Gartmann.
- Updated Brazilian Portugese translations thanks to Carlos Eduardo Moreira dos Santos.
- Updated Spanish translations thanks to Federico Vera and Paco Molinero.
- Don't allow equations to start with any of +*/%.
- Completed Spanish translations of program and man page thanks to navnelson.
- Partial Portuguese translations of the man page thanks to Tiago Silva.
- Fix typo in Makefile causing translated man pages to not be installed.
- Complete Danish translations (both program and man page) thanks to Jimmy Frydkær Jense
- Partial Czech translations of ralcalc by DrakecZ
- Updated Brazilian Portugese translations thanks to Enrico Nicoletto.
- Further Polish translations thanks to pp/bs.
- Further Spanish translations thanks to Feder Sáiz
- omplete Brazilian Portugese translation of the man page thanks to Enrico Nicoletto.
- Complete United Kingdom English translation of the man page thanks to Jen Ockwell.
- Complete Polish translation of the man page thanks to pp/bs.
- Partial French translation of the man page thanks to Johan Serre.
- Partial Spanish translation of the man page thanks to Feder Sáiz
- Use dynamic allocation for the .ralcalc_result path string to avoid possible truncation leading to the incorrect file being opened.
- Minor code tidy-ups, including more consistent error code handling.
- Complete Brazilian Portugese translations thanks to Enrico Nicoletto.
- Some French translation of the man page thanks to Pierre Rudloff.
- United Kingdom English translations thanks to Jen Ockwell (I'm UK English anyway, but it's nice to have someone else check what I've written!)
- Preserve some spaces in equations when output. This will compress multiple spaces into a single space, but there will always be at least a single space in the output if there is one in the input.
- Added support for the "-s prefix" option to allow the output to be formatted with a specified SI prefix.
- Fixed bug where SI prefixes entered on their own were treated as a number of value zero. This means that "= 1/p" correctly produces an error now.
- Fixed bug that caused incorrect handling of "sqrt".
- Errors and debug messages are now written on stderr.
- The man page is now written in docbook format to allow easier translation.
- Included Basque translations thanks to Mikel Alzibar.
- Included Polish translations thanks to "pp/bs".
- Included further Brazilian Portugese translations thanks to Enrico Nicoletto.
- Fix bug whereby the precedence wasn't reset correctly after processing a pair of brackets. This would lead to problems with calculations where a power directly followed a close bracket: [2+3]^3.
- Included Brazilian Portugese translations thanks to Ricardo Ichizo.
- Included French translations thanks to Djalil Oulmane.
- Included Spanish translations thanks to Daniel.
- By request, explicit support for square root (sqrt) has been added.
- Added support for the "-a" option which prints out all of the available operators, functions and constants.
- Fixed a string buffer that was being allocated one byte too small and would occasionally lead to spurious "invalid operator" errors.
- Support for sin, cos, tan, asin, acos, atan functions.
- Support for pi and exp constants.
- Inclusion of Hebrew translations thanks to Yaron.
- Added the "-f filename" option. This will process each line of "filename" as though it was typed in at the command line.
- Added the "-i" option which does the same as "-f" but for stdin.
- Added support for log/ln functions.
- Add missing file to the download.
- Internationalisation and localisation support (want to help translate? Go to Launchpad).
- Build tools improvements.
- Change of licence to GPL.
- Added the "-r" option to cause the result to use neither SI prefixes nor exponents.
- Added the "-q" option to produce a quiet output.
- Added the "-e" option to cause the result to be of the form "1e-3" rather than use SI prefixes.
- Fixed the return code on error.
- Fixed negation precedence. No outstanding problems.
- Precedence is now reset correctly after processing a pair of brackets. Previously, the power in e.g. "= [1+2]^3" was being ignored.
- Brackets are matched better, so "= ]1+2[" is detected as being invalid.
- Fixed Makefiles on Mac OS X.
- Included missing "=.1" file in download.
- Fixed uninstall target.
- Added support for 1e3 style numbers.
- Changed number output format slightly so that we get 0.1 instead of 100m.
- Allow () brackets as well as .
- Allow "," as a decimal point, depending on locale.
- Fixed operator precedence, number negation excluded.
- Added a man page.
This code is licensed under GPL licence. See the COPYING file in the download for more
ralcalc version numbers are constructed like so: x.y.z[.t], where: X is the major version number and a change in this represents a significant and probably incompatible change in functionality. Y is the minor version number and a change represents a general change in functionality. Z is the revision number and represents a change to the code that doesn't introduce new features - so most likely bug fixes. The optional t number is used to indicate string updates when new translations become available for existing versions.
ralcalc was written in C by Roger Light to fulfill his own needs. He knows that
there are other languages that are better suited to this kind of thing, but he
isn't really bothered about that.
Questions/suggestions should be directed to roger_atchoo_org. Replace the _ with @ and . respectively.