项目作者: bfontaine

项目描述 :
Basic formulas interpreter
高级语言: JavaScript
项目地址: git://github.com/bfontaine/FormulaJS.git
创建时间: 2016-08-09T20:35:55Z
项目社区:https://github.com/bfontaine/FormulaJS

开源协议:MIT License

下载


FormulaJS

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

Note: this is an old, unmaintained project.

Usage

  1. formula <file>
  2. formula <formula>

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 /).

Examples

  1. formula -2+3 # 1
  2. formula "((42-5)(12*3+2))^3" # 2779431416
  3. formula PI*1.5 # 4.71238898038469