formula

Basic formulas interpreter.

npm install formula
21 downloads in the last month

FormulaJS

This is an interpreter for basic formulas, based on an original idea by @tsalmon.

Install

(sudo) npm install formula    # local
(sudo) npm install -g formula # global

Usage

formula <file>

Features

  • Floats & integers, negative and positive numbers
  • basic operations (+, -, /, *) and power (^)
  • constants (E, PI)
  • some syntaxic sugar (e.g. (…)(…) instead of (…)*(…)), various alternatives for some operations (e.g. or × instead of *, ÷ instead of /).

In the future, FormulaJS will be able to handle unknow variables and more functions (log, cos/sin/tan, etc).

Formula Examples

-2+3
((42-5)(12*3+2))^3
3.1415*18
npm loves you