Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for Float and double datatype in Java

Current License: CC BY-SA 3.0

6 events
when toggle format what by license comment
Jan 22, 2025 at 16:54 comment added Henry @KrzysztofTomaszewski don't mix up precision and accuracy. Rounding errors influence the accuracy, You can loose almost all accuracy even with a single operation if you subtract two nearly equal quantities.
Jan 21, 2025 at 15:50 comment added Krzysztof Tomaszewski This precision is strongly depends on how many mathematical operations (like addition) you execute over numbers (float or double). With each operation there is some error (in mathematical sense). These errors accumulate. After like 100.000 additions for float the actual precision is like 3 digits and for long it's like 8 digits.
Oct 10, 2024 at 21:26 comment added gshock Ok. I found an article that explained it very well arshadsuraj.medium.com/…. Thanks ✌️
Oct 10, 2024 at 13:05 comment added Henry @gshock try also System.out.println(Float.parseFloat("0.987654321")); which gives you 0.9876543
Oct 5, 2024 at 6:35 comment added gshock float give you 8 digits precision. The result of System.out.println(Float.parseFloat("0.123456789")); -> 0.12345679
Dec 22, 2014 at 7:16 history answered Henry CC BY-SA 3.0

AltStyle によって変換されたページ (->オリジナル) /