Skip to content

Commit

Permalink
v.4.4.0 Gemoni
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuszgromada committed Jan 14, 2020
1 parent 7df9f55 commit 77b81ab
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions CURRENT/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,75 @@
*** https://play.google.com/store/apps/details?id=org.mathparser.scalar.pro ***
*** http://scalarmath.org/ ***


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"

v.4.3.3 (2019-01-27): Bug fix

* No Operator between Argumant and Parentheses #170 https://github.com/mariuszgromada/MathParser.org-mXparser/issues/170
Expand Down

0 comments on commit 77b81ab

Please sign in to comment.