A Java geek
Read post

double, BigDecimal, or Fixed-Point?: Precision, Performance, and Sane Choices for Numbers in Java

A deep technical guide on choosing between double, BigDecimal, and fixed-point arithmetic in Java. Covers IEEE 754 internals, NaN and -0.0 edge cases, compensated summation algorithms (Kahan, Neumaier, pairwise), BigDecimal pitfalls (immutability trap, equals vs compareTo, construction from double), fast double rounding techniques, and fixed-point arithmetic using long. Also surveys libraries (JavaMoney/Moneta, Joda-Money, decimal4j, Apache Commons Numbers) and addresses production concerns: JSON serialization precision loss, testing strategies, thread safety (volatile, DoubleAdder), parallel stream non-determinism, and Project Valhalla's potential impact on numeric type performance.

    #java
Jun 14•26m read time•From blog.frankel.ch
Post cover image
26.9K Impressions
A Java geek's image
A Java geek

Frankel's platform covers topics related to software development, technology trends, and coding tut...

83 Followers

•

1.2K Upvotes

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard