SShortSingh.
Back to feed

Why Banks Using NestJS Must Never Store Money as Floating-Point Numbers

0
·1 views

A mid-sized bank's finance officer discovered a recurring reconciliation discrepancy that took engineers two days to investigate, only to find no single bug or breach was responsible. The root cause traced back to an early architectural decision to represent monetary values using standard floating-point numbers, which cannot store certain decimal values exactly. JavaScript's floating-point format, while suitable for scientific computing, silently accumulates tiny rounding errors when used for currency calculations across millions of transactions. To prevent such drift, engineers building financial systems in NestJS are advised to enforce three layers of protection: validating amounts as decimal strings at the DTO level, storing values in fixed-precision numeric database columns, and using dedicated decimal arithmetic libraries for all calculations. The article argues that this single design choice — how money is represented internally — determines whether a financial system can maintain long-term numerical accuracy.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Engineer explains how to stay in control when AI writes most of your code

A developer at Exequtech describes using Claude Code to build production software, including an offline-first Android app and migration scripts, while maintaining full engineering ownership. He warns that AI agents left unchecked tend to refactor uninstructed code, fabricate APIs, and produce output that is subtly wrong in ways that surface only weeks later. His approach involves precisely defining constraints before prompting, carefully reading every diff, and interrogating the agent's reasoning rather than passively accepting its output. He also acknowledges a personal trade-off: shipping more while coding less has caused some atrophy in core programming instincts, which he counters by hand-writing code when sprint schedules allow. He frames the key distinction as using AI as a tool under deliberate control versus becoming a passive passenger to its output.

0
ProgrammingDEV Community ·

AWS WAF and CloudFront KVS Enable App-Detected, Edge-Enforced Bot Blocking

A feedback loop architecture using AWS WAF Dynamic Label Interpolation and Amazon CloudFront KeyValueStore (KVS) allows applications to detect malicious behavior and delegate enforcement to the network edge. The application layer, which has full context such as repeated login failures, identifies threats and writes fingerprint data to KVS via a PutKey call. CloudFront Functions then read KVS on subsequent requests to challenge or block flagged fingerprints before they reach the origin server. To reduce false-positive impact, each KVS entry carries an expiry timestamp that automatically lifts restrictions after a set period, with a daily cleanup job removing stale entries. A staged approach — registering fingerprints as 'challenge' before escalating to 'block' based on pass rates — adds an additional safeguard against wrongly blocking legitimate users.

0
ProgrammingDEV Community ·

Microsoft and Databricks Enable Single-Copy Data Sharing via OneLake and Unity Catalog

Microsoft and Databricks have converged on a shared technical foundation — OneLake storage and Unity Catalog governance — allowing organisations to maintain a single copy of Delta tables accessible across both platforms. The integration, which reached broad availability by mid-2026, eliminates the long-standing need to duplicate data and maintain separate governance models for each platform. Three distinct mechanisms enable the interoperability: Mirrored Azure Databricks Catalog (generally available), OneLake External Locations for Unity Catalog (in beta), and the Publish to Fabric workflow. Together, these tools let engineering teams write data in Databricks while Fabric, Power BI, and other Microsoft tools query the same physical files without copying them. Choosing the wrong integration mechanism, however, can recreate the old two-copy architecture under a new guise, making deliberate design decisions critical.

0
ProgrammingDEV Community ·

How TDS Classic Controls Item Deployment, Updates, and Deletions in Sitecore

TDS Classic uses three deployment settings — Item Deployment, Child Item Synchronization (CIS), and Recursive Deploy Action (RDA) — to determine how items are handled in a target Sitecore database during a deploy. Item Deployment is a per-item property that controls whether an individual item is created, overwritten, or skipped, without affecting its siblings or descendants. CIS determines how deep TDS scans a parent item's descendants, acting as a gate for RDA, which governs what happens to Sitecore items not present in the project. These settings operate on different axes and never overlap, meaning misconfigurations can cause unexpected outcomes such as templates being overwritten or deletions not reaching the web database. The behavior described applies to TDS Classic 6.x on Sitecore 10.x, as well as late TDS 5.x releases.

Why Banks Using NestJS Must Never Store Money as Floating-Point Numbers · ShortSingh