This question has already been answered:
I forgot. 360 * x / 100 where the type is x float, the result on the calculator is 0.0895522392 in the program gives 0.08955224, why did he cut me like that?
This question has already been answered:
I forgot. 360 * x / 100 where the type is x float, the result on the calculator is 0.0895522392 in the program gives 0.08955224, why did he cut me like that?
A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .
If you want complete control over calculations, use specialized types, instead of built-in
For example:
public static void main(String[] args) { float x = 0.024875622f; int scale = 10; System.out.println(new BigDecimal(360).multiply(new BigDecimal(x)).divide(new BigDecimal(100), scale, RoundingMode.FLOOR)); } Source: https://ru.stackoverflow.com/questions/806765/
All Articles