A command-line calculator for dollar number calculations with flexible number format support.
- Basic Math Operations: +, -, *, /, %
- Mathematical Functions:
sqrt(x),pow(base, exp),abs(x),max(a, b),min(a, b) - Real-Time Stock Prices: Use
$SYMBOLas a variable to fetch the current market price$AAPL,$TSLA,$BTC-USD
- Flexible Number Formats: Supports $ prefix and comma separators
$1,420,368.941,420,368.941420368.94
- Format Preservation: Output matches the format (dollar sign, commas, decimal precision) of the first number in the expression.
- Interactive REPL Mode: Enter expressions interactively.
- One-Shot Mode: Evaluate expressions directly from command-line arguments.
brew tap NoPointExc/homebrew-tap
brew install dbcgit clone https://github.com/NoPointExc/dbc.git
cd dbc
cargo install --path .Pass an expression as arguments to evaluate it and exit:
dbc '$AAPL'
# Output: $247.99
dbc '$1,000 + $AAPL'
# Output: $1,247.99
dbc "400 * 5%"
# Output: 20Tip: Always use single quotes ('...') or double quotes ("...") around expressions in your shell to avoid interpretation of characters like $ or *.
Run dbc without arguments to enter the interactive REPL:
dbc| Command | Description |
|---|---|
/help |
Show help message |
/clear |
Clear the screen |
/exit |
Exit the calculator |
# |
Start a comment (everything after # is ignored) |
> $AAPL
$247.99
> $1,000 + $AAPL
$1,247.99
> 400 * 4%
16
| Input | Parsed Value |
|---|---|
$1,420,368.94 |
1420368.94 |
1,420,368.94 |
1420368.94 |
1420368.94 |
1420368.94 |
Output format matches the first operand in the expression.
MIT