<commit_before># tcalc
A terminal calculator

## Usage
tcalc supports two modes of usage: terminal and REPL.

```bash
# Terminal
$ tcalc "2**8 - 1" "ans >> 1"
255
127
```

```bash
# REPL
$ tcalc
> 2**8 - 1
  255
> ans >> 1
  127
> exit
```

## Precedence

| Operator | Description                      |
|----------|----------------------------------|
| ( )      | parens                           |
| - !      | negate, bitwise NOT              |
| \*\*     | exponentiation                   |
| * / %    | multiplication, division, modulo |
| + -      | addition, subtraction            |
| << >>    | left shift, right shift          |
| &        | bitwise AND                      |
| ^        | bitwise XOR                      |
| \|       | bitwise OR                       |

## REPL

| Commands | Description              |
|----------|--------------------------|
| exit     | exit the REPL            |
| quit     | alias for exit           |

## Built-in Variables

| Variable | Description                   |
|----------|-------------------------------|
| e        | Euler's number (e)            |
| pi       | Archimedes' constant (π)      |
| ans      | Result of previous expression |<commit_msg>Add numeric formatting to README.md<commit_after># tcalc
A featureful calculator for when you want to do math in a terminal.

## Usage
tcalc supports two modes of usage: terminal and REPL.

```bash
# Terminal
$ tcalc "2**8 - 1" "ans >> 1"
255
127
```

```bash
# REPL
$ tcalc
> 2**8 - 1
  255
> ans >> 1
  127
> exit
```

## Syntax

| Operator | Description                      |
|----------|----------------------------------|
| ( )      | parens                           |
| - !      | negate, bitwise NOT              |
| \*\*     | exponentiation                   |
| * / %    | multiplication, division, modulo |
| + -      | addition, subtraction            |
| << >>    | left shift, right shift          |
| &        | bitwise AND                      |
| ^        | bitwise XOR                      |
| \|       | bitwise OR                       |

| Numeric Format | Description                |
|----------------|----------------------------|
| 0b[0-1]        | binary literal             |
| 0o[0-7]        | octal literal              |
| 0x[0-9a-f]     | hexadecimal literal        |
| [0-9]          | decimal literal            |
| [0-9].[0-9]    | fractional decimal literal |

| Variable | Description                   |
|----------|-------------------------------|
| e        | Euler's number (e)            |
| pi       | Archimedes' constant (π)      |
| ans      | Result of previous expression |

## REPL

| Command | Description              |
|---------|--------------------------|
| exit    | exit the REPL            |
| quit    | alias for exit           |
{'fraction_non_alphanumeric': 0.21591720199857245, 'fraction_numerical': 0.019628836545324768, 'mean_word_length': 0.9767277856135402, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '549429', 'n_tokens_mistral': 832, 'n_tokens_neox': 733, 'n_words': 201}