Is there a way to remove the exponent from a double on the client side in GWT?
public double evaluate(final double leftOperand, final double rightOperand) {
Double rtnValue = new Double(leftOperand * rightOperand);
//Need code to remove exponent before returning
return rtnValue.doubleValue();
}
Removing exponents is possible on the server side using NumberFormat:
NumberFormat formatter = new DecimalFormat("#0.00");
System.out.println(number);
System.out.println(formatter.format(number));
However, attempting this on the client side throws an exception:
"No source code is available for type java.text.NumberFormat; did you forget to inherit a required module?"
This is due to GWT not including the java.text library in its JRE Emulation Reference.
I also attempted using String.format("%.2f", doubleResult);, but it seems String.format() is not supported in GWT.
So, what alternatives are available to avoid exponential notation in doubles on the client side?