Gavin Howard's bc

From Rosetta Code
Gavin Howard's bc is an implementation of bc. Other implementations of bc.

This bc was written by Gavinhoward.

This bc is default in FreeBSD 13 and 14, and the bc's in toybox and busybox are based on this bc.

These extensions are in OpenBSD bc, but not in POSIX:

  • The -e and f options.
  • Global stacks.
  • # Line comments.
  • Relational operators (== <= >= != < >) in any expression, not only in 'if', 'while', or 'for'.
  • Boolean operators (! && ||).
  • else branch of an 'if' statement.
  • print statement, with escapes like '\n'.
  • Special variable last, also known as . (a single dot).
  • Scientific and engineering notation.
  • A pseudo-random number generator.
  • A way to get user input (read()).

And many more.