Skip to main content

A command-line calculator tool that can perform basic arithmetic operations

Project description

HLCalculator

A powerful command-line calculator that supports basic arithmetic, scientific operations, and mathematical constants.

Features

  • Basic arithmetic operations:

    • Addition (+)
    • Subtraction (-)
    • Multiplication (*)
    • Division (/)
    • Power (^)
  • Scientific operations:

    • Square root (sqrt)
    • Logarithm (log)
    • Trigonometric functions (sin, cos, tan)
    • Factorial
  • Mathematical constants:

    • π (pi)
    • e
    • τ (tau)

Installation

Using pip:

pip install hlcalculator

Using Poetry:

poetry add hlcalculator

Usage

The calculator provides two main commands:

  • hlcal calc: For calculations
  • hlcal const: For mathematical constants

Basic Operations

hlcal calc 5 + 3         # Addition: 8.0
hlcal calc 10 - 4        # Subtraction: 6.0
hlcal calc 3 '*' 4       # Multiplication: 12.0 (use quotes for *)
hlcal calc 15 / 3        # Division: 5.0
hlcal calc 2 ^ 3         # Power: 8.0

Scientific Operations

hlcal calc 16 sqrt       # Square root: 4.0
hlcal calc 100 log 10    # Log base 10: 2.0
hlcal calc 0.5 sin       # Sine (in radians): 0.479
hlcal calc 5 factorial   # Factorial: 120.0

Mathematical Constants

hlcal const pi           # π: 3.141592653589793
hlcal const e            # e: 2.718281828459045
hlcal const tau          # τ: 6.283185307179586

Development

Requirements

  • Python 3.12 or higher
  • Poetry for dependency management

Setup Development Environment

  1. Clone the repository
git clone https://github.com/hailv/hlcalculator.git
cd hlcalculator
  1. Install dependencies
poetry install
  1. Activate virtual environment
poetry shell

Code Quality Tools

The project uses several code quality tools:

  • black: Code formatting
  • flake8: Style guide enforcement
  • mypy: Static type checking
  • isort: Import sorting

Run all code quality checks:

poetry run black .
poetry run flake8 .
poetry run mypy .
poetry run isort .

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hlcalculator-0.1.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hlcalculator-0.1.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file hlcalculator-0.1.1.tar.gz.

File metadata

  • Download URL: hlcalculator-0.1.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.9 Darwin/24.4.0

File hashes

Hashes for hlcalculator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 de45333ece6315743848cbd347464d711685dfd910d57c5e6654717adb88dbef
MD5 79eb52157601aacff517609283e190de
BLAKE2b-256 de5d0d54a5e0a9a6c9d30828a84806c21e3e4f3a5de5ebb092a724f562372613

See more details on using hashes here.

File details

Details for the file hlcalculator-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: hlcalculator-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.9 Darwin/24.4.0

File hashes

Hashes for hlcalculator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 208edb6036e43052b032a49989e752761953028a1041d219c6e3d3439d46515b
MD5 27a25f6db8ca31348c3355cdc9410e5a
BLAKE2b-256 54907a58b7af69742b1beabce0615d669976284dab9dc7ac50f0311a2c5b259a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page