4

I use Qalculate! as my calculator tool. It comes with a command-line companion tool "qalc". I discovered that it uses comma "," as decimal separator in numbers. Because the comma is already taken for that role, it expects semicolon ";" instead of comma "," in function calls:

Functions is normally entered in an expression by writing the name followed by arguments, separated by commas (or semicolons in languages with comma as decimal point), in parenthesis, thus following the syntax name(arg1, arg2, ...). (source)

That's a mess. As a programmer, I will never remember to use semicolon to separate function arguments, and will always get errors like this at first:

$ qalc "binomial(5, 3)"
error: You need at least 2 argument(s) (Exponent; Index) in function binomial().

So how can I configure qalc to use period "." as decimal separator and consequently comma "," as parameter separator?

1 Answer 1

4

Solution

Set decimal_comma=0 in the following two configuration files:

  • ~/.config/qalculate/qalc.cfg for the command-line calculator tool
  • ~/.config/qalculate/qalculate-gtk.cfg for the GUI calculator tool

Alternative Solutions

  • A command line option. As a non-permanent way to provide the same configuration as above, you can call qalc like this:

    qalc -set "decimal comma off" "binomial(5, 3)"
    
  • A command in interactive mode. When you start the command-line tool as just qalc you are in interactive mode. There, you can apply the same configuration as above by entering this command and pressing Return:

    set decimal comma off
    
  • Changing the locale. Qalculate! evaluates LC_NUMERIC from your system's locale settings to determine what character to use as decimal separator (source). The remaining character of period and comma then becomes the parameter separator. So execute echo $LC_NUMERIC to see if it's right. If not, you might want to change or fix your locale settings.

  • "Ignore locale" option. Starting with version 3.0, there is an option to ignore the system locale and instead use English. Usage: qalc -set "ignore locale" "binomial(5, 3)". Or in the qalcinteractive mode, useset ignore locale`. (source)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.