---
title: "Floating point can’t hold a cent. BigDecimal can, until commonMain."
url: https://daily.dev/posts/floating-point-can-t-hold-a-cent-bigdecimal-can-until-commonmain--i5juqbqsc
source_url: https://proandroiddev.com/floating-point-cant-hold-a-cent-bigdecimal-can-until-commonmain-0ba3d6c49115
type: article
source: "ProAndroidDev"
published: 2026-06-13T22:30:58.693Z
updated: 2026-06-14T08:19:32.546Z
tags: ["kotlin"]
reading_time: 8
upvotes: 11
comments: 1
language: 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.

# Floating point can’t hold a cent. BigDecimal can, until commonMain.

**[ProAndroidDev](https://daily.dev/sources/pand)** · 8 min read · 11 upvotes · 1 comments

## Summary

Floating-point types like Double cannot represent decimal fractions exactly, making them unsuitable for monetary calculations. Three approaches exist: binary floats (fast but imprecise), integer minor units (exact but can't divide cleanly), and BigDecimal (correct but JVM-only). Kotlin Multiplatform removes BigDecimal from commonMain, forcing teams to build expect/actual wrappers backed by BigDecimal (JVM), NSDecimalNumber (iOS), and decimal.js (JS/Wasm) — three engines with different precision limits and failure modes. The post walks through BigDecimal's own traps (constructor lies, scale-sensitive equality, division exceptions, rounding modes) and introduces Deci, an open-source KMP library that normalizes behavior across all three backends, enforces explicit rounding, and serializes money as strings.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://proandroiddev.com/floating-point-cant-hold-a-cent-bigdecimal-can-until-commonmain-0ba3d6c49115>

## Community discussion

Top comments from developers on daily.dev.

**@daniel8000** · 1 upvotes

> Classic. God bless you man!

## Similar posts on daily.dev

- [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
- [double, BigDecimal, or Fixed-Point?: Precision, Performance, and Sane Choices for Numbers in Java](https://daily.dev/posts/double-bigdecimal-or-fixed-point-precision-performance-and-sane-choices-for-numbers-in-java-exsbowoaa) · A Java geek · 14 upvotes · 0 comments
- [Why JavaScript Floating Point Math Breaks Your App \(And How to Fix It\)](https://daily.dev/posts/why-javascript-floating-point-math-breaks-your-app-and-how-to-fix-it--0nl3mfyyi) · Sergio Lema · 1 upvotes · 0 comments
- [Why Ruby’s Issue Tracker Still Links to a 1991 Paper About Floating-Point Numbers](https://daily.dev/posts/why-ruby-s-issue-tracker-still-links-to-a-1991-paper-about-floating-point-numbers-vijgzx189) · RUBYLAND · 1 upvotes · 1 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/floating-point-can-t-hold-a-cent-bigdecimal-can-until-commonmain--i5juqbqsc)
