try {
return decimal.toBigIntegerExact();
}
catch (ArithmeticException e) {
}
return decimal.stripTrailingZeros();
}
/**
* Parses the given string into a Java Number object representing a rational.
* The Java object is chosen such that .equals() works correctly across all Number-derived objects.
*/