Backend Development 2 min read

BigDecimal vs Long for Monetary Values: Pros, Cons, and Common Pitfalls

A developer team debates whether to store monetary amounts as BigDecimal or long, discussing experience‑based preferences, past incidents, and asking the community for real‑world pitfalls of each approach.

Architect's Guide
Architect's Guide
Architect's Guide
BigDecimal vs Long for Monetary Values: Pros, Cons, and Common Pitfalls

The team lead and the R&D director got into an argument about whether monetary amounts in the system should be designed as BigDecimal or long.

The team lead, an experienced developer, argues for BigDecimal, citing many past projects where it was used without issues.

The director insists on long, recalling a previous incident where using a monetary type caused serious problems, and after switching to long the issues disappeared.

From my perspective with one year of work and three years of development experience, I find long more convenient because calculations do not require conversion.

Has anyone encountered pitfalls related to monetary design choices in their projects?

What are the common pitfalls of BigDecimal? What are the pitfalls of long?

Below are responses from various experts (content not reproduced here).

backendJavadata typesBigDecimalLongMonetary
Architect's Guide
Written by

Architect's Guide

Dedicated to sharing programmer-architect skills—Java backend, system, microservice, and distributed architectures—to help you become a senior architect.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.