Bug 289484 -  Integer variable value should not be shown as a float
diff --git a/bundles/org.eclipse.e4.languages.javascript.debug.connect/src/org/eclipse/e4/languages/javascript/debug/connect/JSONConstants.java b/bundles/org.eclipse.e4.languages.javascript.debug.connect/src/org/eclipse/e4/languages/javascript/debug/connect/JSONConstants.java
index 14125ad..72b0fab 100644
--- a/bundles/org.eclipse.e4.languages.javascript.debug.connect/src/org/eclipse/e4/languages/javascript/debug/connect/JSONConstants.java
+++ b/bundles/org.eclipse.e4.languages.javascript.debug.connect/src/org/eclipse/e4/languages/javascript/debug/connect/JSONConstants.java
@@ -56,7 +56,6 @@
 	public static final String PROTOTYPE_OBJECT = "prototypeObject"; //$NON-NLS-1$
 	public static final String PROTO_OBJECT = "protoObject"; //$NON-NLS-1$
 	public static final String CONSTRUCTOR_FUNCTION = "constructorFunction"; //$NON-NLS-1$
-	public static final String NAN = "NaN"; //$NON-NLS-1$
 
 	// id constants
 	public static final String THREAD_ID = "threadId"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.e4.languages.javascript.debug.jsdi.rhino/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.languages.javascript.debug.jsdi.rhino/META-INF/MANIFEST.MF
index a0ccb7e..92f6f11 100644
--- a/bundles/org.eclipse.e4.languages.javascript.debug.jsdi.rhino/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.languages.javascript.debug.jsdi.rhino/META-INF/MANIFEST.MF
@@ -10,5 +10,4 @@
  org.eclipse.e4.languages.javascript.jsdi.connect,
  org.eclipse.e4.languages.javascript.jsdi.event,
  org.eclipse.e4.languages.javascript.jsdi.request,
- org.eclipse.osgi.util;version="1.1.0",
- org.mozilla.javascript
+ org.eclipse.osgi.util;version="1.1.0"
diff --git a/bundles/org.eclipse.e4.languages.javascript.debug.jsdi.rhino/src/org/eclipse/e4/languages/javascript/jsdi/rhino/NumberValueImpl.java b/bundles/org.eclipse.e4.languages.javascript.debug.jsdi.rhino/src/org/eclipse/e4/languages/javascript/jsdi/rhino/NumberValueImpl.java
index 9104a7e..8e9fd64 100644
--- a/bundles/org.eclipse.e4.languages.javascript.debug.jsdi.rhino/src/org/eclipse/e4/languages/javascript/jsdi/rhino/NumberValueImpl.java
+++ b/bundles/org.eclipse.e4.languages.javascript.debug.jsdi.rhino/src/org/eclipse/e4/languages/javascript/jsdi/rhino/NumberValueImpl.java
@@ -4,12 +4,11 @@
 
 import org.eclipse.e4.languages.javascript.debug.connect.JSONConstants;
 import org.eclipse.e4.languages.javascript.jsdi.NumberValue;
-import org.mozilla.javascript.ScriptRuntime;
 
 /**
  * Rhino implementation of {@link NumberValue}
  * 
- * @since 1.0
+ * @since 0.9
  */
 public class NumberValueImpl extends MirrorImpl implements NumberValue {
 
@@ -57,6 +56,11 @@
 		return JSONConstants.NUMBER;
 	}
 
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.e4.languages.javascript.jsdi.NumberValue#isNaN()
+	 */
 	public boolean isNaN() {
 		return value == null;
 	}
@@ -68,8 +72,8 @@
 	 */
 	public String toString() {
 		if (value == null) {
-			return JSONConstants.NAN;
+			return NAN;
 		}
-		return ScriptRuntime.numberToString(value.doubleValue(), 10);
+		return value.toString();
 	}
 }
diff --git a/bundles/org.eclipse.e4.languages.javascript.debug.jsdi/src/org/eclipse/e4/languages/javascript/jsdi/NumberValue.java b/bundles/org.eclipse.e4.languages.javascript.debug.jsdi/src/org/eclipse/e4/languages/javascript/jsdi/NumberValue.java
index e4c15d0..4c247f4 100644
--- a/bundles/org.eclipse.e4.languages.javascript.debug.jsdi/src/org/eclipse/e4/languages/javascript/jsdi/NumberValue.java
+++ b/bundles/org.eclipse.e4.languages.javascript.debug.jsdi/src/org/eclipse/e4/languages/javascript/jsdi/NumberValue.java
@@ -1,8 +1,40 @@
 package org.eclipse.e4.languages.javascript.jsdi;
 
+/**
+ * Abstract representation of a {@link Number} value with-respect-to JavaScript debugging.
+ * 
+ * @since 0.9
+ */
 public interface NumberValue extends Value {
 
-	Number value();
+	/**
+	 * Represents the value for 'Not A Number'
+	 */
+	public static final String NAN = "NaN"; //$NON-NLS-1$
+	/**
+	 * Represents the value for negative infinity
+	 */
+	public static final String NEG_INFINITY = "-Infinity"; //$NON-NLS-1$
+	/**
+	 * Represents the value for positive infinity
+	 */
+	public static final String INFINITY = "Infinity"; //$NON-NLS-1$
 
+	/**
+	 * Returns the underlying {@link Number} value for this value.<br>
+	 * <br>
+	 * This method can return <code>null</code> if its value value is not a number.
+	 * 
+	 * @return the underlying {@link Number} value
+	 * @see #NAN
+	 */
+	public Number value();
+
+	/**
+	 * Returns if the this {@link NumberValue} is a valid number or not.
+	 * 
+	 * @return true if this is a valid number false otherwise.
+	 * @see #NAN
+	 */
 	boolean isNaN();
 }
diff --git a/bundles/org.eclipse.e4.languages.javascript.debug.model/src/org/eclipse/e4/languages/javascript/debug/model/JSDIDebugModel.java b/bundles/org.eclipse.e4.languages.javascript.debug.model/src/org/eclipse/e4/languages/javascript/debug/model/JSDIDebugModel.java
index 0ace42d..a5482e4 100644
--- a/bundles/org.eclipse.e4.languages.javascript.debug.model/src/org/eclipse/e4/languages/javascript/debug/model/JSDIDebugModel.java
+++ b/bundles/org.eclipse.e4.languages.javascript.debug.model/src/org/eclipse/e4/languages/javascript/debug/model/JSDIDebugModel.java
@@ -13,6 +13,7 @@
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.model.IDebugTarget;
 import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.e4.languages.javascript.jsdi.NumberValue;
 import org.eclipse.e4.languages.javascript.jsdi.VirtualMachine;
 
 /**
@@ -64,4 +65,34 @@
 	static IDebugTarget newJSDIDebugtarget(VirtualMachine vm, IProcess process, ILaunch launch, String name, boolean canterminate, boolean candisconnect) {
 		return new JSDIDebugTarget(vm, process, launch, name, canterminate, candisconnect);
 	}
+
+	/**
+	 * Converts the given double value to a {@link String} removing the trailing .0 in the event the precision is 1
+	 * 
+	 * @param n
+	 *            the number to convert
+	 * @return the {@link String} value of the number with trailing .0 removed iff the precision is 1
+	 */
+	public static String numberToString(Number n) {
+		double d = n.doubleValue();
+		if (d != d) {
+			return NumberValue.NAN;
+		}
+		if (d == Double.POSITIVE_INFINITY) {
+			return NumberValue.INFINITY;
+		}
+		if (d == Double.NEGATIVE_INFINITY) {
+			return NumberValue.NEG_INFINITY;
+		}
+		if (d == 0.0) {
+			return "0"; //$NON-NLS-1$
+		}
+		// we only care about base 10
+		String number = Double.toString(d);
+		// we only convert for a precision equal to 1
+		if (number.endsWith(".0")) { //$NON-NLS-1$
+			number = number.substring(0, number.length() - 2);
+		}
+		return number;
+	}
 }
diff --git a/bundles/org.eclipse.e4.languages.javascript.debug.model/src/org/eclipse/e4/languages/javascript/debug/model/JSDIValue.java b/bundles/org.eclipse.e4.languages.javascript.debug.model/src/org/eclipse/e4/languages/javascript/debug/model/JSDIValue.java
index b8d7446..c2ef158 100644
--- a/bundles/org.eclipse.e4.languages.javascript.debug.model/src/org/eclipse/e4/languages/javascript/debug/model/JSDIValue.java
+++ b/bundles/org.eclipse.e4.languages.javascript.debug.model/src/org/eclipse/e4/languages/javascript/debug/model/JSDIValue.java
@@ -20,6 +20,7 @@
 import org.eclipse.e4.languages.javascript.debug.connect.JSONConstants;
 import org.eclipse.e4.languages.javascript.jsdi.ArrayReference;
 import org.eclipse.e4.languages.javascript.jsdi.FunctionReference;
+import org.eclipse.e4.languages.javascript.jsdi.NumberValue;
 import org.eclipse.e4.languages.javascript.jsdi.PropertiesReference;
 import org.eclipse.e4.languages.javascript.jsdi.Property;
 import org.eclipse.e4.languages.javascript.jsdi.Value;
@@ -77,8 +78,15 @@
 			return array.getValues().toString();
 		}
 		if (this.value instanceof FunctionReference) {
+			// TODO this would be slick to show the function body code
 			return ((FunctionReference) this.value).functionName();
 		}
+		if (this.value instanceof NumberValue) {
+			NumberValue nvalue = (NumberValue) this.value;
+			if (!nvalue.isNaN()) {
+				return JSDIDebugModel.numberToString(nvalue.value());
+			}
+		}
 		return this.value.toString();
 	}
 
@@ -112,6 +120,12 @@
 			buffer.append(this.value.toString()).append(JSONConstants.SPACE).append("(id=unknown)"); //$NON-NLS-1$
 			return buffer.toString();
 		}
+		if (this.value instanceof NumberValue) {
+			NumberValue nvalue = (NumberValue) this.value;
+			if (!nvalue.isNaN()) {
+				return JSDIDebugModel.numberToString(nvalue.value());
+			}
+		}
 		return this.value.toString();
 	}