math: Fix docs on --scale

Fixes #9983

(cherry picked from commit e555f1b235)
This commit is contained in:
Fabian Boehm 2023-08-25 16:17:19 +02:00
parent 7260e1f828
commit 04b2e9629f

View file

@ -17,8 +17,9 @@ Description
``math`` performs mathematical calculations. ``math`` performs mathematical calculations.
It supports simple operations such as addition, subtraction, and so on, as well as functions like ``abs()``, ``sqrt()`` and ``ln()``. It supports simple operations such as addition, subtraction, and so on, as well as functions like ``abs()``, ``sqrt()`` and ``ln()``.
By default, the output is a floating-point number with trailing zeroes trimmed. By default, the output shows up to 6 decimal places.
To get a fixed representation, the ``--scale`` option can be used, including ``--scale=0`` for integer output. To change the number of decimal places, use the ``--scale`` option, including ``--scale=0`` for integer output.
Trailing zeroes will always be trimmed.
Keep in mind that parameter expansion happens before expressions are evaluated. Keep in mind that parameter expansion happens before expressions are evaluated.
This can be very useful in order to perform calculations involving shell variables or the output of command substitutions, but it also means that parenthesis (``()``) and the asterisk (``*``) glob character have to be escaped or quoted. This can be very useful in order to perform calculations involving shell variables or the output of command substitutions, but it also means that parenthesis (``()``) and the asterisk (``*``) glob character have to be escaped or quoted.