LinuxCommandLibrary

ic

Calculate image properties

TLDR

View documentation for the original command

$ tldr ibmcloud
copy

SYNOPSIS

ic [expression]

DESCRIPTION

ic is a lightweight, interactive calculator designed for quick mathematical computations directly from the Linux shell. It supports standard infix mathematical expressions with operators like +, -, *, /, and ^ for exponentiation, along with parentheses for grouping.

Key features include:
• Trigonometric functions: sin(), cos(), tan(), asin(), acos(), atan()
• Log and exp: log(), ln(), exp()
• Common functions: sqrt(), abs(), floor(), ceil(), round()
• Constants: pi, e
• Variables: assign with =, e.g., x=5; x*2
• Bases: hex (0xFF), octal (0o777), binary (0b101)

In interactive mode (ic), enter expressions line-by-line; results print immediately. Quit with Ctrl-D or empty line. For one-shot use: ic 'expr'. Uses double-precision floating point. No readline support by default, keeping it fast and minimal. Ideal for scripts or ad-hoc calculations where bc feels heavy.

CAVEATS

No command-line options or flags; positional expression only. Double precision limits accuracy for very large/small numbers. No expression history, scripting, or complex numbers. Interactive mode reads from stdin exclusively.

EXAMPLES

ic
pi/2
1.5708
sin(pi/2)
1
0x10 + 0b11
19
quit

ic 'sqrt(144)+sin(pi)'
12

FUNCTIONS LIST

sin, cos, tan, asin, acos, atan, sinh, cosh, tanh,
log, ln, log10, exp, sqrt, cbrt, abs, floor, ceil, round, hypot.

HISTORY

Developed by Nick Bowler starting around 2009 as a simple C-based calculator. Hosted on GitHub (nickbowler/ic), packaged in Debian/Ubuntu since ~2010. Focuses on minimalism and shell integration, avoiding dependencies like readline.

SEE ALSO

bc(1), dc(1), calc(1)

Copied to clipboard