ralcalc

Section: (1)
Updated: 12 February 2010
Index Return to Main Contents
 

NAME

ralcalc - Une calculatrice simple en ligne de commandes  

SYNOPSIS

ralcalc {-a | --all} | {-h | --help} | {-v | --version} ralcalc [-e | -r] [-f nom de fichier] [-i] [-q] [-s préfixe] équation = {-a | --all} | {-h | --help} | {-v | --version} = [-e | -r] [-f nom de fichier] [-i] [-q] [-s préfixe] équation  

DESCRIPTION

racalc est une calculatrice en ligne de commande dont le but est de réaliser des calculs très rapide où un seul résultat est attendu, sans avoir à démarrer, puis quitter un programme.

ralcalc est aussi installé sous la commande = pour encore plus de rapidité.  

OPTIONS

-a, --all
Afficher tous les opérateurs disponibles, les fonctions et les constantes.
-e
Afficher le résultat sous la forme "1e-3" plutôt qu'avec les préfixes du Système International (SI).
-f
Procéder à une liste de calculs contenue dans un fichier. Veuillez vous référer à la section fichier d'entrée (FILE INPUT) ci-dessous pour plus d'informations.
-h, --help
Afficher les détails d'utilisation, de version et de contact.
-i
Process a list of calculations from stdin. See the FILE INPUT section below for more information.
-q
Afficher seulement le résultat (donc cacher l'entrée et de possibles erreurs)
-r
Montre le résultat sous le format décimal sans les préfixes du SI, sans exposant.
-s
Afficher le résultat en utilisant un préfixe particulier du SI. Cette option est ignorée si -e /option > ou -r est aussi utilis
-v, --version
Afficher les détails d'utilisation, de version et de contact.
 

FORMAT NUMéRIQUE

Numbers should be input using either "." or "," as a decimal point (this is locale dependent so both may not work in your locale), with no thousands separators.

ralcalc supports SI prefix characters for both input and output:


        = 2u/35
        2u/35 = 57.1429n

Numbers of the form 1e-3 are also supported, where the "e" indicates a power of ten. Don't mix and match SI prefixes and "e" in the same number (although 1e-3n is valid, 1ne-3 is not - avoid both for less confusion).

Les préfixes du SI supportés sont : Y, Z, E, P, T, G, M, k, m, u, n, p, f, a, z, y.  

OPéRATEURS

Les opérateurs mathématiques simples pour l'addition (+), la soustraction (-), la multiplication (*, x), la division (/) et la puissance (^) sont supportés, l'addition et la soustraction ayant la priorité la plus basse et la puissance ayant la plus haute. Placeholder-1 / >

Les parenthèses ((), []) peuvent être utilisées pour contrôler l'ordre dans lequel les opérations sont traitées : placeholder-1 / >

Both the square and round brackets can be used and are both directly equivalent, so [1+2)x3 is also valid. Round brackets are more commonly used in mathematics, but the square brackets (and the "x" for multiplication) are included to try to prevent problems with the shell expanding those characters.

ralcalc stores the result of the calculation so that it can be used in the next calculation with the "_" character.


        = 2^0.5
        2^0.5 = 1.41421

        = 1/_
        1/_ = 0.707107
 

FONCTIONS

The functions sin, cos, tan, asin, acos, atan, sqrt, log (base 10 logarithm) and ln (natural logarithm) are supported. The trigonometric functions work on radians. The use of brackets is not necessary, but is recommended where precedence may be confusing. The functions have equal precedence to multiplication/division, so care must be taken:


        = sin2x2
        sin2x2 = 1.81859

        = sin[2x2]
        sin[2x2] = -0.756802
 

CONSTANTES

The constants pi (3.14159) and exp (2.71828) can be used and are treated the same as any other number.  

FICHIER D'ENTRéE

A list of calculations can be processed at once by placing them in a file. Each line of the file will be process exactly the same as if ralcalc had been run with those arguments. The file could look like the following (note the lack of the command = or ralcalc):


        2^0.5
        1/_
        238/1064x100

File input is also possible using stdin, i.e. reading interactively directly from the terminal with each line being calculated as normal. To quit, type "q" or "quit" on a new line, use Ctrl-D to indicate the end of file, or use Ctrl-C to cause ralcalc to be terminated.

If either of the file input options are given on the command line, then any calculations given on the command line will be calculated first. If both of the file input options are given, then the calculations from the -f will be carried out first, followed by those from stdin.  

EXEMPLES

Calcul basique :


        = ln 1.0001
        ln 1.0001 = 99.995u

format de sortie en exposant:


        = -e ln 1.0001
        ln 1.0001 = 9.9995e-05

Raw number output format:


        = -r ln 1.0001
        ln 1.0001 = 0.000100

Number output format with a specified SI prefix:


        = -s m ln 1.0001
        ln 1.0001 = 0.099995
 

VARIABLES D'ENVIRONNEMENT

ACCUEIL
Determines where the .ralcalc_result file is stored.
 

VALEURS DE SORTIE

0
Réussite
1
Au moins une erreur est survenue.
 

FICHIERS

${HOME}/.ralcalc_result
The result of the most recent calculation, which can be accessed in a later calculation using the "_" character. Note that this is not necessarily portable across different machine architectures.
 

DIAGNOSTIQUES

ralcalc attempts to notify the user of as many errors as possible and indicate where those errors are, if they are user input related.

If an unknown character is included in the equation, an "unknown token" error will be generated. The error marker points to the invalid character.


        = 34/3@2

        Error: 34/3@2
                   ^ unknown token

If an invalid number is included, a "bad number" error will be generated. The error marker points to the end of the invalid number.


        = 3.14.159x2.8^2

        Error: 3.14.159x2.8^2
                      ^ bad number

If the number of open and close brackets do not match, a "mismatched brackets" error will be generated. The error marker position has no significance.


        = 5/[[2+3]*9

        Error: 5/[[2+3]*9
                         ^ mismatched brackets

If an operator appears in an invalid position, an "invalid operator" error will be generated. The error marker indicated the invalid operator.


        = 3^^7

        Error: 3^^7
                 ^ invalid operator

If a bracket appears in an invalid position, an "invalid bracket" error will be generated. This type of error often overlaps with other errors, so there will be a number of messages written to the screen. It is best to fix this error first as it will likely be the root cause of the problem. The error marker indicates the invalid bracket.


        = [2+]3

        Error: [2+]3
                  ^ invalid bracket

        Error: [2+]3
                    ^ invalid operator

Siralcalc ne peut allouer un peu de mémoire, une erreur "Plus de mémoire disponible" sera générée.

Internal error: If the parser notices two numbers next to each other yet does not generate a "bad number" error, the a "duplicate number" error will be generated. This should never happen.

Internal error: If an unknown error code is passed to the error output function, an "unknown error" will be generated and the invalid error code displayed. This should never happen.  

BOGUES

Only a single "-f filename" can be passed at once.

If you find a bug, please submit a report at http://bugs.launchpad.net/ralcalc  

DéVELOPPEUR

Roger Light <roger@atchoo.org>


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
FORMAT NUMéRIQUE
OPéRATEURS
FONCTIONS
CONSTANTES
FICHIER D'ENTRéE
EXEMPLES
VARIABLES D'ENVIRONNEMENT
VALEURS DE SORTIE
FICHIERS
DIAGNOSTIQUES
BOGUES
DéVELOPPEUR

This document was created by man2html, using the manual pages.
Time: 22:11:25 GMT, February 12, 2010