Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

calc-rs

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

calc-rs

  • 0.2.0
  • PyPI
  • Socket score

Maintainers
1

calc-rs

a calculator module for Python and Rust capable of computing arbitrarily long equations and functions.

Speed Test

These tests were done using hyperfine and the speed-test.sh script in the test folder

testing python version:
Benchmark 1:  python -c "import calculator as calc; calc.solve_func(\"f(x)= 4+3x+x**2+x**3\", -1000, 1000)"
  Time (mean ± σ):      1.150 s ±  0.018 s    [User: 1.130 s, System: 0.016 s]
  Range (min … max):    1.126 s …  1.231 s    50 runs


testing rust version:
Benchmark 1:  python -c "import calculators as calc; calc.solve_func(\"f(x)= 4+3x+x^2+x^3\", -1000, 1000)"
  Time (mean ± σ):      11.8 ms ±   0.8 ms    [User: 10.6 ms, System: 3.6 ms]
  Range (min … max):    11.1 ms …  14.5 ms    25 runs

As you can see the rust version is significantly faster.

Usage

there are three functions that this libray exposes:

FunctionArgsDescription
solveequasions: list(str)takes a list of equations as strings and solves eatch one returning a list of answers.
solve_funcf: str, start: int, stop: intsolves the function, f, at all integer points between start and stop.
solve_funcsfs: list(str), start: int, stop: intsolves a list of functions, fs, for all integer points between start and stop. returns a dictionary whose keys are function names and whose values are a tuple of a list of x values and a list of y values.

Installation

with pip:

pip install calc-rs

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc