0

in java i can not separate a exactly decimal part of a floating point number

19th Apr 2017, 8:51 AM
Baki Billah 131312
Baki Billah 131312 - avatar
4 Antworten
+ 2
Floating numbers are not calculated with 100% precision in any programming language. This is a long story to explain so just keep it in mind when working with it. For example this is a reason to not use float when you working with money amounts.
19th Apr 2017, 11:15 AM
Jeth
Jeth - avatar
+ 1
That is because of floating point operation and will happen everywhere where you use floats. Try BigDecimal for arbitrary precision. Might not be that fast, of you do it often.
19th Apr 2017, 9:03 AM
1of3
1of3 - avatar
0
accepted output is like as (.394) bt real output is (.3933333....) bt why that occurred I can't explain and can't solve this, what is the solution
19th Apr 2017, 8:55 AM
Baki Billah 131312
Baki Billah 131312 - avatar