``` ||||| _ _ _ _ = Z . = | |_ | | |_ __ _ _ _ _ ___| |_ = , = | ' \| | | ' \| ' \ _| ' \/ -_) _| = o ` = |_||_|_|_|_|_|_|_||_(_)_||_\___|\__| ||||| ``` # hwcalc hwcalc, or `hc`, is a calculator for arbitrary bit-width two's complement numbers. - [man page](/man/hc.1) - [source code](https://git.sr.ht/~nhellman/hwcalc) - [releases](https://git.sr.ht/~nhellman/hwcalc/refs) - [crate](https://crates.io/crates/hwcalc) - [online demo](demo) It is primarily created for performing quick calculations and conversions between bases during hardware development, hence the name. For quick conversions, `hc` will always display the result in multiple bases: ```hwcalc > 4919 4_919 = 0b1_0011_0011_0111 = 0o1_1467 = 0x1337 > 0x539 1_337 = 0b101_0011_1001 = 0o2471 = 0x539 ``` `hc` can work with two's complement numbers of any bit width: ```hwcalc > 5 + 0b1000i4 -3 (= 13) = 0b1101 = 0o15 = 0xd > -38 -38 = 0b(1)01_1010 = 0o(7)32 = 0x(f)da ``` Other features include: - specific or infinite bit width, - fixed-point numbers, specific or infinite precision, - repeating digits for input and output, - assignable variables, - colored input and output, - readline capabilities. See the [EXAMPLES](/man/hc.1#EXAMPLES) section in the man page for examples of how to use them.