if(x.getType().isInteger()){
IInteger k = (IInteger) x;
return values.integer(k.toReal().scale());
}
if(x.getType().isRational()){
IRational k = (IRational) x;
return values.integer(k.toReal().scale());
}
return values.integer(((IReal) x).scale());
} catch (ArithmeticException ae) {
throw RuntimeExceptionFactory.arithmeticException(ae.getMessage(), null, null);
}