<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/double-bigdecimal-or-fixed-point-precision-performance-and-sane-choices-for-numbers-in-java-exsbowoaa" -->

---
title: double, BigDecimal, or Fixed-Point?: Precision,...
description: 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,...
canonical: https://daily.dev/posts/double-bigdecimal-or-fixed-point-precision-performance-and-sane-choices-for-numbers-in-java-exsbowoaa
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: double, BigDecimal, or Fixed-Point?: Precision, Performance, and Sane Choices for Numbers in Java | daily.dev
og:description: 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,...
og:url: https://daily.dev/posts/double-bigdecimal-or-fixed-point-precision-performance-and-sane-choices-for-numbers-in-java-exsbowoaa
og:image: https://api.daily.dev/og/posts/ExSbOwoAA.png
og:image:alt: double, BigDecimal, or Fixed-Point?: Precision, Performance, and Sane Choices for Numbers in Java
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

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

**[A Java geek](https://daily.dev/sources/frankel)** · 26 min read · 14 upvotes · 0 comments

## Summary

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.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.frankel.ch/bigdecimal-vs-double>

## Similar posts on daily.dev

- [Floating point can’t hold a cent. BigDecimal can, until commonMain.](https://daily.dev/posts/floating-point-can-t-hold-a-cent-bigdecimal-can-until-commonmain--i5juqbqsc) · ProAndroidDev · 11 upvotes · 1 comments
- [Why You Should Never Use Floating Point for Money](https://daily.dev/posts/why-you-should-never-use-floating-point-for-money-mf4k3pznd) · Sergio Lema · 17 upvotes · 6 comments

---

Tags: [#java](https://daily.dev/tags/java)

[View this post on daily.dev](https://daily.dev/posts/double-bigdecimal-or-fixed-point-precision-performance-and-sane-choices-for-numbers-in-java-exsbowoaa)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"double, BigDecimal, or Fixed-Point?: Precision, Performance, and Sane Choices for Numbers in Java","url":"https://daily.dev/posts/double-bigdecimal-or-fixed-point-precision-performance-and-sane-choices-for-numbers-in-java-exsbowoaa","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/double-bigdecimal-or-fixed-point-precision-performance-and-sane-choices-for-numbers-in-java-exsbowoaa"},"datePublished":"2026-06-14T16:41:12.712Z","dateModified":"2026-06-14T18:19:34.838Z","description":"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,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/6e9c360370d1929cfedd06f24599932b?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/6e9c360370d1929cfedd06f24599932b?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"A Java geek","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"A Java geek","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/b7f3fdbf443347ea84705578a195085b","url":"https://daily.dev/sources/frankel"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/double-bigdecimal-or-fixed-point-precision-performance-and-sane-choices-for-numbers-in-java-exsbowoaa","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":14},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"java","timeRequired":"PT26M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"A Java geek","item":"https://daily.dev/sources/frankel"},{"@type":"ListItem","position":3,"name":"double, BigDecimal, or Fixed-Point?: Precision, Performance, and Sane Choices for Numbers in Java"}]}
```

