Skip to content

a scientific calculator designed to handle both simple arithmetic and complex mathematical functions

Notifications You must be signed in to change notification settings

acodercat/rust-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Scientific Calculator

Overview

This project is a scientific calculator designed to handle both simple arithmetic and complex mathematical functions, including logarithms, trigonometric operations, and solving linear equations. It supports calculations in both infix and postfix (Reverse Polish Notation, RPN) notations and is capable of understanding constants like Pi and Euler's number (e).

Features

  • Infix and Postfix Notation: Perform calculations using both standard and RPN formats.
  • Mathematical Functions: Supports addition, subtraction, multiplication, division, logarithms (log, ln), and trigonometric functions (sin, cos, tan, ctan).
  • Constants Recognition: Automatically recognizes and calculates expressions involving Pi and e.
  • Equation Solving: Can solve simple linear equations with one variable.
  • Error Handling: Gracefully handles errors, providing meaningful feedback to the user.

Compile and Run

cargo run

Running Tests

cargo test

Generating Documentation

To generate and view the documentation for this project, use the following Cargo commands:

# Generate documentation
cargo doc

# Generate documentation and open it in your browser
cargo doc --open

Examples

Here are a few examples of how to use the calculator:

  • (3+(4-1))*530
  • 2 * x + 0.5 = 1x=0.25
  • 2 9 +11
  • 2 9 + 2 *22
  • log(10)1
  • log101
  • sin(pi)0
  • sin(pi) + ln(e)1
  • sinpi0
  • sin(1.5pi)-1
  • sin(1.5*pi)-1
  • pi3.14159265
  • 2pi6.28318531
  • e2.71828183
  • log100(10)0.5

About

a scientific calculator designed to handle both simple arithmetic and complex mathematical functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages