Giter Club home page Giter Club logo

expr4j's Introduction

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'
}

expr4j's People

Contributors

dependabot[bot] avatar prat-man avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.