小编kos*_*tas的帖子

我如何围绕12.443到12.40

我正在计算,我得到12,443.我想把它四舍五入到12,40.这是我尝试这样做的方式,但我得到12而不是12,40

float result = Math.round( (new Float(result1)*0.3) + (new Float(result2)*0.7) );
vprosvasis.setText( Float.toString(result) );
Run Code Online (Sandbox Code Playgroud)

例子:

  • 如果我得到12,70001我想要舍入到12,7
  • 如果我得到13,4402将它四舍五入到13,4
  • 11,19到11,2

因此,最终的数字将始终为##.@格式

android

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

android ×1