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.0.tar.gz (6.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.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hlcalculator-0.1.0.tar.gz
  • Upload date:
  • Size: 6.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.0.tar.gz
Algorithm Hash digest
SHA256 8285b9471bbf109bd2009d08fb0da94bb4afc0f145afa1c8381b5f072677d76c
MD5 bd379c0b0d9a8b0fa5f53f3e5a36c14a
BLAKE2b-256 9031daa8cdc15f71b1f90bc1c58cb8b5b560ac2f37934b19157ae5fb8c40ea97

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hlcalculator-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae3f4d32a74c5e2d47fbbde285ce5966d221dfd726a9e6f84bcaff5737e0b6db
MD5 392a20ecb83a08b2c17ffef1d2039588
BLAKE2b-256 6d7f7e79f068f6ed145e76fad89ebca204260775d559ad4b78d4f69d5985cecb

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