Skip to content

Commit

Permalink
1^^Infinity tetration special case fix #261
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuszgromada committed May 29, 2022
1 parent e90ce11 commit f9719ca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,7 @@ public static double tetration(double a, double n) {
if (Double.IsNaN(a)) return Double.NaN;
if (Double.IsNaN(n)) return Double.NaN;
if (Double.IsPositiveInfinity(n)) {
if (BinaryRelations.isEqualOrAlmost(a, 1)) return 1.0;
if (abs(a - MathConstants.EXP_MINUS_E) <= BinaryRelations.DEFAULT_COMPARISON_EPSILON)
return MathConstants.EXP_MINUS_1;
if (abs(a - MathConstants.EXP_1_OVER_E) <= BinaryRelations.DEFAULT_COMPARISON_EPSILON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,7 @@ public static double tetration(double a, double n) {
if (Double.isNaN(a)) return Double.NaN;
if (Double.isNaN(n)) return Double.NaN;
if (n == Double.POSITIVE_INFINITY) {
if (BinaryRelations.isEqualOrAlmost(a, 1)) return 1.0;
if (abs(a - MathConstants.EXP_MINUS_E) <= BinaryRelations.DEFAULT_COMPARISON_EPSILON)
return MathConstants.EXP_MINUS_1;
if (abs(a - MathConstants.EXP_1_OVER_E) <= BinaryRelations.DEFAULT_COMPARISON_EPSILON)
Expand Down

0 comments on commit f9719ca

Please sign in to comment.