diff --git a/trick_source/java/src/trick/common/utils/vs/VSDouble.java b/trick_source/java/src/trick/common/utils/vs/VSDouble.java index dc8e78b0..3ef14759 100644 --- a/trick_source/java/src/trick/common/utils/vs/VSDouble.java +++ b/trick_source/java/src/trick/common/utils/vs/VSDouble.java @@ -12,7 +12,7 @@ public class VSDouble extends VSValue<Double> { @Override public void fromVariableServer(String string) { - setValue(Double.parseDouble(string.trim())); + setValue(Double.parseDouble(handleUndefinedValues(string).trim())); } @Override diff --git a/trick_source/java/src/trick/common/utils/vs/VSFloat.java b/trick_source/java/src/trick/common/utils/vs/VSFloat.java index a1bf9759..0250293b 100644 --- a/trick_source/java/src/trick/common/utils/vs/VSFloat.java +++ b/trick_source/java/src/trick/common/utils/vs/VSFloat.java @@ -12,7 +12,6 @@ public class VSFloat extends VSValue<Float> { @Override public void fromVariableServer(String string) { - setValue(Float.parseFloat(string.trim())); + setValue(Float.parseFloat(handleUndefinedValues(string).trim())); } - } diff --git a/trick_source/java/src/trick/common/utils/vs/VSValue.java b/trick_source/java/src/trick/common/utils/vs/VSValue.java index bf05da7c..725a6f64 100644 --- a/trick_source/java/src/trick/common/utils/vs/VSValue.java +++ b/trick_source/java/src/trick/common/utils/vs/VSValue.java @@ -44,4 +44,19 @@ public abstract class VSValue<T> implements VariableServerFluent, Cloneable { } } + protected String handleUndefinedValues(String input) { + if(input.equals("inf")) { + input = "Infinity"; + } + else if(input.equals("-inf")) { + input = "-Infinity"; + } + else if(input.equals("nan")) { + input = "NaN"; + } + else if(input.equals("-nan")) { + input = "-NaN"; + } + return input; + } }