Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 2.06 KB

README.md

File metadata and controls

50 lines (38 loc) · 2.06 KB

Expression Evaluator for Java

Maven

Expr4j is a Java library to parse and evaluate mathematical expression strings.

The expressions are evaluated using Dijkstra's Shunting Yard algorithm. An expression tree is created from the postfix (or RPN) expression which is then parsed to evaluate the expression. The library is written entirely using generics so it can be used with any type of operands.

Predefined implementations are provided in the packages expr4j-double, expr4j-bigdecimal, and expr4j-complex.

Note
Version 1.x of Expr4j is a complete rewrite of the library. The new API is incompatible with the 0.0.x versions.


Key Features

  • Supports numerical functions, operations, constants, and variables.
  • Written using generics to allow easy extension for any type of operands including user defined types.
  • Multiple predefined implementations including BigDecimal and Complex numbers.
  • Supports addition of custom functions and operators.
  • Functions can be defined with a variable number of arguments.
  • Supports implicit multiplication, ex: 2x is treated as 2*x and (a+b)(a-b) is treated as (a+b)*(a-b).
  • Supports lazy evaluation of functions and operators for improved performance.
  • Supports asynchronous evaluation for improved performance.
  • Supports scientific notations of numbers.

Dependency Management

Maven

<dependency>
    <groupId>in.pratanumandal</groupId>
    <artifactId>expr4j</artifactId>
    <version>1.0</version>
</dependency>

Gradle

dependencies {
    implementation 'in.pratanumandal:expr4j:1.0'
}