Java Math.pow() Rounding Error

后端 未结 4 1781
囚心锁ツ
囚心锁ツ 2021-01-25 14:24

I\'m having trouble with (what I suspect is) a rounding error.

I have a string, 0.686357E-01, which I\'m trying to convert to a double. I\'ve been able to s

4条回答
  •  清酒与你
    2021-01-25 14:48

    You don't need to split it, Double.parseDouble can handle those kinds of numbers just fine.

    double number = Double.parseDouble("0.686357E-01");
    

    See? It works!

提交回复
热议问题