Coder Social home page Coder Social logo

glorious-calc's Introduction

glorious-calc

CLI calculator for genuises in a hurry

Glorious Calc provides the user a quick access to a calculator. It uses the program's arguments as a single formula to resolve. It can handle integers, real numbers and complex numbers ! Its goal is to provide the user a quick access to a computation system without having to launch a programming-language interpreter (like Python or Ruby).

The syntax of the glorious calc is similar to the classic mathematical syntax. It accepts pairs of (), [] and {} as parentheses, Basic operations are allowed (+ - * /) plus the power operation (^) and the modulo (mod). Functions have the lowest priority in calculus and do not require parentheses, so sqrt 5 + 3 = sqrt(5 + 3).

Example :

$ calc 5 + 8 - 4i
13 - 4i

$ calc 6 / [2 + i]
2.4 - 1.2i

Glorious Calc has some built-in functions accessible directly.

  • sqrt : square root
  • cos : cosine
  • sin : sine
  • tan : tangent
  • abs : absolute value
  • ln : natural logarithm
  • log : base 10 logarithm
  • exp : exponential
  • conj : conjugate complex
  • Re : real part
  • Im : Imaginary part

Some custom functions can be created by defining a context before the formula. This is made with the following syntax :

let *function-name* *argument-list* = *function-formula* : *formula*
$ calc let f x = 5i + x : f 7
7 + 5i

Each declaration must be separated of the following one using a comma. Functions that take several arguments are called like the others but with their arguments separated by a comma :

$ calc let f x y = 2 + x / y, x = 4 : f x, 5
2.8

glorious-calc's People

Contributors

docteur-lalla avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.