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.
#r "nuget: MathParser.org-mXparser, 4.4.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install MathParser.org-mXparser as a Cake Addin
#addin nuget:?package=MathParser.org-mXparser&version=4.4.2

// Install MathParser.org-mXparser as a Cake Tool
#tool nuget:?package=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

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

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.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on MathParser.org-mXparser:

Package Downloads
LightConversion.Topas4
Library to control optical parametric amplifiers by Light Conversion.
FrontLookCoreLibraryAssembly
This package adds an asp.net core class library!
ProCode.Business
Package Description
Vsa.Framework
Vsa Framework

GitHub repositories (2)

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

Repository Stars
ArduPilot/MissionPlanner
Mission Planner Ground Control Station (c# .net)
MUnique/OpenMU
This project aims to create an easy to use, extendable and customizable server for a MMORPG called "MU Online".

Version History

Version Downloads Last updated
4.4.2 124,779 1/25/2020
4.4.1 4,293 1/15/2020
4.4.0 14,266 1/11/2020
4.3.3 168,823 1/27/2019
4.3.2 848 1/25/2019
4.3.1 3,881 1/19/2019
4.3.0 390 1/19/2019
4.2.2 38,198 10/11/2018
4.2.1 18,836 7/18/2018
4.2.0 825 7/15/2018
4.1.1 64,765 7/28/2017
4.1.0 1,524 7/8/2017
4.0.0.2 8,923 4/16/2017
4.0.0.1 983 4/8/2017
4.0.0 1,234 3/26/2017
3.0.0 21,723 5/17/2016
2.4.0.2 1,144 3/19/2016
2.4.0.1 843 3/12/2016
2.4.0 731 3/12/2016