相关疑难解决方法(0)

降低双倍的准确性

我发现谷歌搜索的所有内容都表明,以下任何一种方法都会将双倍减少到两位小数.

double roundToFourDecimals(double d)
{
    DecimalFormat twoDForm = new DecimalFormat("#.##");
    double myD = Double.valueOf(twoDForm.format(d));
    return myD;
}

double nextLon = (double)Math.round(bnextLon * 100.0) / 100.0;
Run Code Online (Sandbox Code Playgroud)

但这对我都不起作用.double的值是3.3743984E7,结果是相同的.怎么了?

java android

1
推荐指数
1
解决办法
156
查看次数

标签 统计

android ×1

java ×1