Skip to content

Commit

Permalink
Merge pull request #10 from LunarClient/fix-arc-functions
Browse files Browse the repository at this point in the history
  • Loading branch information
bernie-g authored Jun 13, 2024
2 parents 0f93ad7 + 042d1d3 commit d0700b3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
/**
* Arc cosine function
*/
public class AcosDegrees extends Function {
public class Acos extends Function {

public AcosDegrees(String name) {
public Acos(String name) {
super(name);
}

Expand All @@ -20,7 +20,7 @@ public int getRequiredArguments() {

@Override
public double _evaluate(Expr[] arguments, ExecutionContext ctx) {
double a = this.evaluateArgument(arguments, ctx, 0) / 180 * Math.PI;
double a = this.evaluateArgument(arguments, ctx, 0);
if (Math.abs(a) > 1) {
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
/**
* Arc sine function
*/
public class AsinDegrees extends Function {
public class Asin extends Function {

public AsinDegrees(String name) {
public Asin(String name) {
super(name);
}

Expand All @@ -20,7 +20,7 @@ public int getRequiredArguments() {

@Override
public double _evaluate(Expr[] arguments, ExecutionContext ctx) {
double a = this.evaluateArgument(arguments, ctx, 0) / 180 * Math.PI;
double a = this.evaluateArgument(arguments, ctx, 0);
if (Math.abs(a) > 1) {
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
/**
* Arc tangent function
*/
public class AtanDegrees extends Function {
public class Atan extends Function {

public AtanDegrees(String name) {
public Atan(String name) {
super(name);
}

Expand All @@ -20,7 +20,7 @@ public int getRequiredArguments() {

@Override
public double _evaluate(Expr[] arguments, ExecutionContext ctx) {
double a = this.evaluateArgument(arguments, ctx, 0) / 180 * Math.PI;
double a = this.evaluateArgument(arguments, ctx, 0);
return Math.atan(a);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ private static void addFunction(Map<FunctionDefinition, Function> map, String ta
addFunction(map, "math", new SinDegrees("sin"));
addFunction(map, "math", new Sin("sinradians"));
addFunction(map, "math", new Sign("sign"));
addFunction(map, "math", new AsinDegrees("asin"));
addFunction(map, "math", new AcosDegrees("acos"));
addFunction(map, "math", new AtanDegrees("atan"));
addFunction(map, "math", new Asin("asin"));
addFunction(map, "math", new Acos("acos"));
addFunction(map, "math", new Atan("atan"));
addFunction(map, "math", new Atan2("atan2"));
addFunction(map, "math", new Exp("exp"));
addFunction(map, "math", new Ln("ln"));
Expand Down

0 comments on commit d0700b3

Please sign in to comment.