下面列出了java.lang.Math#rint ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private Object round(Object l, Object r) throws ParseException {
if (l instanceof Number && r instanceof Number)
{
int dp = ((Number)r).intValue();
double val = ((Number)l).doubleValue();
double mul = Math.pow(10,dp);
return new Double(Math.rint(val*mul)/mul);
}
throw new ParseException("Invalid parameter type");
}
public Object round(Object param)
throws ParseException
{
if (param instanceof Number)
{
return new Double(Math.rint(((Number)param).doubleValue()));
}
throw new ParseException("Invalid parameter type");
}
public static MR_double rint ( MR_double x ) { return new MR_double(Math.rint(x.get())); }