MathParser.org-mXparser 4.4.2

mXparser is a super easy, rich, fast and highly flexible math expression parser library (parser and evaluator of mathematical expressions / formulas provided as plain text / string). Software delivers easy to use API for JAVA, Android and C# .NET/MONO (Common Language Specification compliant: F#, Visual Basic, C++/CLI). *** If you find the software useful donation is something you might consider: http://mathparser.org/donate/ *** Scalar Scientific Calculator, Charts and Scripts, Scalar Lite: https://play.google.com/store/apps/details?id=org.mathparser.scalar.lite *** Scalar Pro: https://play.google.com/store/apps/details?id=org.mathparser.scalar.pro *** ScalarMath.org: http://scalarmath.org/ *** MathSpace.pl: http://mathspace.pl/ ***

Install-Package MathParser.org-mXparser -Version 4.4.2
dotnet add package MathParser.org-mXparser --version 4.4.2
<PackageReference Include="MathParser.org-mXparser" Version="4.4.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MathParser.org-mXparser --version 4.4.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

v.4.4.2 (2020-01-26): Gemoni - Bug fixing

  • #200 System.OutOfMemoryException: Array dimensions exceeded supported range (https://github.com/mariuszgromada/MathParser.org-mXparser/issues/200)
  • #199 cancelCurrentCalculation does not stop for some expressions (https://github.com/mariuszgromada/MathParser.org-mXparser/issues/199)

v.4.4.0 (2020-01-14): Gemoni - API improvement

Canonical rounding: Bye bye floating point arithmetic artifacts

ULP rounding is switched of as a default setting (can be enabled / disabled). As a default canonical rounding is switched on (can be disabled / enabled). New methods:

  • mXparser.enableCanonicalRounding()
  • mXparser.disableCanonicalRounding()
  • mXparser.setCanonicalRounding(boolean)
  • mXparser.checkIfCanonicalRounding

Example 1

Expression e = new Expression("0.1 + 0.1 + 0.1");
System.out.println("Pure Java             : 0.1 + 0.1 + 0.1 = " + (0.1 + 0.1 + 0.1));
System.out.println("mXparser              : 0.1 + 0.1 + 0.1 = " + e.calculate());
mXparser.disableCanonicalRounding();
System.out.println("mXparser canonical off: 0.1 + 0.1 + 0.1 = " + e.calculate());
===========
Pure Java             : 0.1 + 0.1 + 0.1 = 0.30000000000000004
mXparser              : 0.1 + 0.1 + 0.1 = 0.3
mXparser canonical off: 0.1 + 0.1 + 0.1 = 0.30000000000000004

Example 2

Expression e = new Expression("(-1/6.2)^(-3)");
System.out.println("Pure Java             : (-1/6.2)^(-3) = " + Math.pow(-1/6.2, -3));
System.out.println("mXparser              : (-1/6.2)^(-3) = " + e.calculate());
mXparser.disableCanonicalRounding();
System.out.println("mXparser canonical off: (-1/6.2)^(-3) = " + e.calculate());
===========
Pure Java             : (-1/6.2)^(-3) = -238.32800000000003
mXparser              : (-1/6.2)^(-3) = -238.328
mXparser canonical off: (-1/6.2)^(-3) = -238.32800000000003

Argument extension - analogy to Function Extension

Now you can define user arguments implementing your own algorithm in source code.

Example

class PiMultArgExt implements ArgumentExtension {
	private int multiple = 0;
	public double getArgumentValue() {
	    multiple++;
		return  MathConstants.PI * multiple;
	}
	public PiMultArgExt clone() {
	    return new PiMultArgExt();
	}
}

Argument x = new Argument("x", new PiMultArgExt());
Expression e = new Expression("x/pi", x);
System.out.println("1st calc exec: " + e.calculate());
System.out.println("2nd calc exec: " + e.calculate());
System.out.println("3rd calc exec: " + e.calculate());
===========
1st calc exec: 1.0
2nd calc exec: 2.0
3rd calc exec: 3.0

Bugs fixed

  • #168, #18 Exact special trigonometric values
  • #192, #178 Logical operators precedence
  • #172 "x + 4 * - 2"

If you find the software useful you might consider below information

Scalar-Lite

Thank you!

v.4.4.2 (2020-01-26): Gemoni - Bug fixing

  • #200 System.OutOfMemoryException: Array dimensions exceeded supported range (https://github.com/mariuszgromada/MathParser.org-mXparser/issues/200)
  • #199 cancelCurrentCalculation does not stop for some expressions (https://github.com/mariuszgromada/MathParser.org-mXparser/issues/199)

v.4.4.0 (2020-01-14): Gemoni - API improvement

Canonical rounding: Bye bye floating point arithmetic artifacts

ULP rounding is switched of as a default setting (can be enabled / disabled). As a default canonical rounding is switched on (can be disabled / enabled). New methods:

  • mXparser.enableCanonicalRounding()
  • mXparser.disableCanonicalRounding()
  • mXparser.setCanonicalRounding(boolean)
  • mXparser.checkIfCanonicalRounding

Example 1

Expression e = new Expression("0.1 + 0.1 + 0.1");
System.out.println("Pure Java             : 0.1 + 0.1 + 0.1 = " + (0.1 + 0.1 + 0.1));
System.out.println("mXparser              : 0.1 + 0.1 + 0.1 = " + e.calculate());
mXparser.disableCanonicalRounding();
System.out.println("mXparser canonical off: 0.1 + 0.1 + 0.1 = " + e.calculate());
===========
Pure Java             : 0.1 + 0.1 + 0.1 = 0.30000000000000004
mXparser              : 0.1 + 0.1 + 0.1 = 0.3
mXparser canonical off: 0.1 + 0.1 + 0.1 = 0.30000000000000004

Example 2

Expression e = new Expression("(-1/6.2)^(-3)");
System.out.println("Pure Java             : (-1/6.2)^(-3) = " + Math.pow(-1/6.2, -3));
System.out.println("mXparser              : (-1/6.2)^(-3) = " + e.calculate());
mXparser.disableCanonicalRounding();
System.out.println("mXparser canonical off: (-1/6.2)^(-3) = " + e.calculate());
===========
Pure Java             : (-1/6.2)^(-3) = -238.32800000000003
mXparser              : (-1/6.2)^(-3) = -238.328
mXparser canonical off: (-1/6.2)^(-3) = -238.32800000000003

Argument extension - analogy to Function Extension

Now you can define user arguments implementing your own algorithm in source code.

Example

class PiMultArgExt implements ArgumentExtension {
	private int multiple = 0;
	public double getArgumentValue() {
	    multiple++;
		return  MathConstants.PI * multiple;
	}
	public PiMultArgExt clone() {
	    return new PiMultArgExt();
	}
}

Argument x = new Argument("x", new PiMultArgExt());
Expression e = new Expression("x/pi", x);
System.out.println("1st calc exec: " + e.calculate());
System.out.println("2nd calc exec: " + e.calculate());
System.out.println("3rd calc exec: " + e.calculate());
===========
1st calc exec: 1.0
2nd calc exec: 2.0
3rd calc exec: 3.0

Bugs fixed

  • #168, #18 Exact special trigonometric values
  • #192, #178 Logical operators precedence
  • #172 "x + 4 * - 2"

If you find the software useful you might consider below information

Scalar-Lite

Thank you!

Release Notes

v.4.4 Gemoni: API improvements: 1. Canonical rounding solving the problem of floating-point arithmetic artifact, 2. ArgumentExtension allowing user defined arguments implementation via source code, 3. Binaries also covering new frameworks: .NET Core 3.1, .NET Standard 2.1, .NET Framework 4.8

Dependencies

This package has no dependencies.

Showing the top 1 GitHub repositories that depend on MathParser.org-mXparser:

Repository Stars
MUnique/OpenMU
This project aims to create an easy to use, extendable and customizable server for a MMORPG called "MU Online".

Read more about the GitHub Usage information on our documentation.

Version History

Version Downloads Last updated
4.4.2 3,332 1/25/2020
4.4.1 1,308 1/15/2020
4.4.0 828 1/11/2020
4.3.3 82,354 1/27/2019
4.3.2 618 1/25/2019
4.3.1 2,891 1/19/2019
4.3.0 183 1/19/2019
4.2.2 24,647 10/11/2018
4.2.1 14,992 7/18/2018
4.2.0 505 7/15/2018
4.1.1 51,471 7/28/2017
4.1.0 990 7/8/2017
4.0.0.2 8,538 4/16/2017
4.0.0.1 600 4/8/2017
4.0.0 922 3/26/2017
3.0.0 15,167 5/17/2016
2.4.0.2 909 3/19/2016
2.4.0.1 609 3/12/2016
2.4.0 480 3/12/2016