# New Version of QCalc Programmer’s Calculator

share on:
Originally published on:
2021-01-13
Last updated on: Tags:

A new Python version of the popular QCalc tool has been released in QTools 6.9.2. The new QCalc is a console application, unlike its predecessor, which was a GUI app (based on Tcl/Tk).

## QCalc Features

The main selling point of the “qcalc” calculator is that it accepts expressions in the C-syntax and outputs integer results in decimal, hexadecimal, and binary formats simultaneously.

The expressions can contain all bit-wise operators (<<, >>, |, &, ^, ~) in the same precedence as C/C++. You can also use mixed decimal, hexadecimal and binary numbers. “qcalc” is also a powerful floating-point scientific calculator and supports all mathematical functions (sin(), cos(), tan(), exp(), ln(), …). Some examples of acceptable expressions are:

• `((0xBEEF << 16) | 1280) & ~0xFF` -- binary operators, mixed hex and decimal numbers
• `(\$1011 << 24) | (1280 >> 8) ^ 0xFFF0` -- mixed @ref qcalc_bin "binary", dec and hex numbers
• `(1234 % 55) + 4321//33` -- remainder, integer division (note the // integer division operator)
• `pi/6` -- pi-constant, storing a value in the `ans` variable
• `pow(sin(ans),2) + pow(cos(ans),2)` -- scientific floating-point calculations, ans-variable

## 64-bit Range

QCalc supports the 64-bit range and switches to 64-bit arithmetic automatically when an integer result of a computation exceeds the 32-bit range. Here are some examples of the 64-bit output:

```> 0xDEADBEEF << 27
= 501427843159293952 | 0x06F5'6DF7'7800'0000
= 0b00000110'11110101'01101101'11110111'01111000'00000000'00000000'00000000
= 0b00000000'11011110'10101101'10111110'11101111'00000000'00000000'00000000
! out of range
>
```

`pip install qcalc`