Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/markknol/hx-mathparser

Evaluates math expressions. Written in Haxe.
https://github.com/markknol/hx-mathparser

expressions haxe math parser

Last synced: about 1 month ago
JSON representation

Evaluates math expressions. Written in Haxe.

Awesome Lists containing this project

README

        

MathParser
==========

Evaluates math expressions. Uses Haxe. I think it could be used in all platforms, no dependencies on haxe libs/OpenFl/Flambe.

### Examples

```haxe
MathParser.parse("1+2-3/4*5");
// returns -0.75

MathParser.parse("1+2--3/4*5");
// returns 6.75

MathParser.parse("(1+2--3)/4*5");
// returns 7.5

MathParser.parse("(1+2- -3)/(((4*.5)))");
// returns 3.0

MathParser.parse("(.1+.2- -.3)/(.4*.5)");
// returns 3.0000000000000004

MathParser.parse("0xFF * 10");
// returns 2550
```
_The parser assumes that the given expression is valid_