Changes
This commit is contained in:
@@ -16,7 +16,6 @@ import org.solovyev.common.msg.MessageRegistry;
|
||||
import org.solovyev.common.msg.Messages;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
@@ -168,19 +167,16 @@ public class JsclMathEngine implements MathEngine {
|
||||
|
||||
// detect if current number is precisely equals to constant in constants' registry (NOTE: ONLY FOR SYSTEM CONSTANTS)
|
||||
final Double localValue = value;
|
||||
IConstant constant = Collections.find(this.getConstantsRegistry().getSystemEntities(), new JPredicate<IConstant>() {
|
||||
public boolean apply(@Nullable IConstant constant) {
|
||||
if (constant != null) {
|
||||
if (localValue.equals(constant.getDoubleValue())) {
|
||||
if (!constant.getName().equals(Constants.PI_INV.getName())) {
|
||||
if (!constant.getName().equals(Constants.PI.getName()) || JsclMathEngine.getInstance().getAngleUnits() == AngleUnit.rad) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
IConstant constant = Collections.find(getConstantsRegistry().getSystemEntities(), new JPredicate<IConstant>() {
|
||||
public boolean apply(@Nonnull IConstant constant) {
|
||||
if (!localValue.equals(constant.getDoubleValue())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
final String name = constant.getName();
|
||||
if (name.equals(Constants.PI_INV.getName()) || name.equals(Constants.ANS)) {
|
||||
return false;
|
||||
}
|
||||
return !name.equals(Constants.PI.getName()) || JsclMathEngine.getInstance().getAngleUnits() == AngleUnit.rad;
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -2,6 +2,8 @@ package jscl.math.function;
|
||||
|
||||
import jscl.math.JsclInteger;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 1/7/12
|
||||
@@ -14,6 +16,8 @@ public final class Constants {
|
||||
public static final Constant I = new Constant("i");
|
||||
public static final Constant INF = new Constant("∞");
|
||||
public static final Constant INF_2 = new Constant("Infinity");
|
||||
@Nonnull
|
||||
public static final String ANS = "ans";
|
||||
|
||||
// not intended for instantiation
|
||||
private Constants() {
|
||||
|
Reference in New Issue
Block a user