# Show HN: A calculator CLI to help your agents perform calculations accurately

> Source: <https://github.com/freakynit/llm-calc>
> Published: 2026-07-07 09:39:35+00:00

`llm-calc`

is a small dependency-free command line calculator intended for LLM agents and scripts. It evaluates common scientific-calculator operations with deterministic `float64`

math, so agents can delegate arithmetic instead of guessing.

Download pre-built binaries from releases, or, build locally as documented below.

On macOS, unsigned downloaded binaries can be blocked by Gatekeeper with a message that the file cannot be opened. After extracting the release archive, remove the quarantine flag:

```
xattr -d com.apple.quarantine ./llm-calc-1.0.0-darwin-arm64
```

Use the actual extracted binary name for your platform, for example
`llm-calc-1.0.0-darwin-amd64`

on Intel Macs.

On Windows, if SmartScreen or PowerShell reports that the downloaded file is
blocked, unblock the extracted `.exe`

:

```
Unblock-File .\llm-calc-1.0.0-windows-amd64.exe
```

The release archives preserve executable permissions on macOS and Linux. If
your shell still reports `permission denied`

after extracting, make it
executable:

```
chmod +x ./llm-calc-1.0.0-darwin-arm64
git clone https://github.com/freakynit/llm-calc
cd llm-calc
go build -o llm-calc .
```

Drop the resulting binary somewhere on `PATH`

.

Cross-compile examples:

```
GOOS=linux GOARCH=amd64 go build -o dist/llm-calc-linux-amd64 .
GOOS=darwin GOARCH=arm64 go build -o dist/llm-calc-darwin-arm64 .
GOOS=windows GOARCH=amd64 go build -o dist/llm-calc-windows-amd64.exe .
llm-calc "2 * sin(pi / 4) ^ 2"
llm-calc "sqrt(81) + abs(-4)"
llm-calc "cos(rad(60))"
llm-calc "-2^2"
```

Always pass exactly one quoted expression. This keeps the interface predictable for LLM agents and avoids shell parsing surprises.

Set output precision:

```
llm-calc -precision 16 "1 / 3"
```

Operators:

```
+  -  *  /  %  ^  !  parentheses
```

Constants:

```
pi  e  tau  phi
```

Functions:

```
abs acos asin atan cbrt ceil cos deg exp fact floor hypot ln log log10
max min mod pow rad round sin sqrt tan
```

Notes:

- Trigonometric functions use radians.
- Use
`rad(degrees)`

and`deg(radians)`

for angle conversion. `log`

and`log10`

are base-10 logarithms.`ln`

is the natural logarithm.`^`

is right-associative, so`2^3^2`

means`2^(3^2)`

.- Factorial only accepts non-negative integers up to
`170`

. - Non-finite results, division by zero, and malformed expressions return a non-zero exit code.
