bc
From Gentoo Wiki
bc is an arbitrary-precision fixed-point mathematical scripting language with a C-like syntax. In modern usage, bc is typically used to overcome the limitations of shell scripting languages which are often restricted to integer arithmetic. In this capacity it is usually embedded into an existing shell script with either a pipe or a HERE-DOCUMENT statement. Use cases requiring floating-point calculations embedded into shell scripts typically call for Perl, Ruby, or Raku in place of bc as all three are one-liner friendly languages.
Installation
USE flags
USE flags for sys-devel/bc Handy console-based calculator utility
Emerge
Emerge sys-devel/bc:
root #
emerge --ask sys-devel/bc
Environment variables
- POSIXLY_CORRECT follow the POSIX standard to the letter. The -s switch has the same effect.
- BC_ENV_ARGS arguments to be passed into bc by default.
- BC_LINE_LENGTH An integer specifying the number of characters per line of output.
Usage
user $
bc --help
usage: bc [options] [file ...] -h --help print this usage and exit -i --interactive force interactive mode -l --mathlib use the predefined math routines -q --quiet don't print initial banner -s --standard non-standard bc constructs are errors -w --warn warn about non-standard bc constructs -v --version print version information and exit
Removal
Unmerge
Uninstall sys-devel/bc:
root #
emerge --ask --depclean --verbose sys-devel/bc