Tagged articles
bigdecimal
91 articles · Page 1 of 1
This article walks through implementing a financial-grade double-entry bookkeeping system using Spring Boot 3, MyBatis, and MySQL, covering domain modeling with immutable entries and derived balances, a posting engine with idempotency and debit-credit validation, balance calculation via snapshots and incremental deltas, end-of-day trial balance verification, cross-system reconciliation, and production concerns like precision handling, sharding strategies, and hot-account mitigation.
IdempotencyMyBatisMySQL
0 likes · 36 min read

This article explains why internationalization and localization should be implemented from the start, covering UTF-8 encoding, locale handling, resource bundles, dynamic content translation strategies, time zone and currency best practices, legal compliance like GDPR, and real-world failure cases.
DateTimeFormatterJavaJavaMoney
0 likes · 12 min read

This article explores advanced Jackson customization in Spring Boot, covering ObjectMapper configuration, global date formatting and BigDecimal precision handling, dynamic sensitive field desensitization using BeanSerializerModifier and ThreadLocal context, and streaming JSON generation with JsonGenerator to handle large datasets without memory overflow.
JacksonObjectMapperSerialization
0 likes · 19 min read

The article surveys ten community‑sourced approaches to representing monetary values in Java, weighing Long, BigDecimal, String, Protobuf, custom types, and other quirky suggestions, and explains the reasoning each contributor gives for their preferred data type.
JavaLongMonetary Precision
0 likes · 4 min read

The article surveys ten community‑suggested approaches for representing monetary values in Java—ranging from using Long, BigDecimal, String, Protobuf, custom types, to following leadership or AI advice—highlighting each option’s rationale and trade‑offs such as precision, range, performance, and maintainability.
JavaLongMonetary
0 likes · 4 min read


java1234Jul 18, 2026 · Backend Development
The article explains why floating‑point types are unsafe for monetary values, compares the Long‑in‑cents and BigDecimal‑in‑yuan approaches, lists their advantages and drawbacks, and provides concrete Java code, database schemas, layer‑boundary conversion patterns, and common pitfalls.
BackendFinancialJava
0 likes · 8 min read

The article dissects the long‑standing Java debate over using double versus BigDecimal for money, explaining that the choice hinges on required precision, rounding rules, and performance limits, and walks through floating‑point fundamentals, common pitfalls, and high‑accuracy summation techniques.
IEEE754JavaKahanSummation
0 likes · 19 min read

This article explores floating-point precision issues in HarmonyOS development, demonstrating how float's 7-digit limit corrupts sensor data, why double increases memory 30% and fails in Native calls, and why BigDecimal kills real-time performance, concluding with a scenario-based selection strategy and validation mechanism.
HarmonyOSNative interfacebigdecimal
0 likes · 10 min read

This article explains why using Java's BigDecimal for high‑precision calculations requires careful constructor selection, demonstrates the hidden errors of the double‑based constructor, shows how to format and compare values, and provides a utility class with safe arithmetic methods.
ArithmeticJavaNumberFormat
0 likes · 24 min read


ITPUBApr 19, 2026 · Fundamentals
This article demystifies why adding two approximated 0.1 values yields an exact 0.2 in floating‑point arithmetic while adding 0.1 and 0.2 fails to produce an exact 0.3, by detailing IEEE‑754 double‑precision storage, binary conversion, rounding effects, and Java code verification.
IEEE 754InterviewJava
0 likes · 9 min read

This article explains how Java's BigDecimal class provides exact arithmetic for numbers beyond double's 16‑digit limit, demonstrates the pitfalls of using the double constructor with concrete examples, and guides developers through constructors, common methods, formatting, exception handling, and a utility class for high‑precision calculations.
ArithmeticJavaNumberFormat
0 likes · 27 min read

A developer asks whether monetary amounts should be stored as Long or BigDecimal, and the article compiles ten varied community suggestions—ranging from using Long, BigDecimal, String, custom types, Protobuf, leadership directives, AI answers, frugal choices, to whimsical ideas—each with brief explanations and illustrative images.
JavaLongMonetary Values
0 likes · 4 min read

This article compares ten community‑sourced approaches for representing monetary values in Java, explaining when a simple Long, a precise BigDecimal, a String, custom wrappers, Protobuf tricks, leadership directives, AI assistance, or even minimal integer types are appropriate, and why each choice matters.
JavaLongMonetary
0 likes · 3 min read

The article explores the common dilemma of choosing between Long and BigDecimal for monetary values, summarizing ten distinct community suggestions ranging from using Long, BigDecimal, String, Protobuf, custom types, leadership advice, AI assistance, to minimalist integer approaches.
JavaLongbigdecimal
0 likes · 4 min read

This article explains how Java's BigDecimal class maintains exact decimal precision by scaling numbers to integers, detailing its internal fields, the add method implementation, and a concrete example that demonstrates the underlying computation steps.
Javabigdecimalfinance
0 likes · 6 min read

This article outlines four common pitfalls when using Java's BigDecimal for high‑precision calculations—constructing from floating‑point literals, using equals for comparison, losing precision in division, and rounding issues—and provides practical solutions such as using string constructors, compareTo, specifying scale and rounding mode.
bigdecimalfloating-pointprecision
0 likes · 5 min read

Floating‑point numbers cannot precisely represent many decimal values, leading to cumulative errors in financial calculations, so Java’s BigDecimal class is recommended for high‑precision arithmetic to avoid such inaccuracies and ensure reliable monetary computations.
Financial-CalculationsJavabigdecimal
0 likes · 2 min read

This article compares five Java techniques for checking whether a string represents a valid number—including manual character iteration, Integer.parseInt/Double.parseDouble, BigDecimal, regular expressions, and Apache Commons NumberUtils—showing code samples, test cases, and the pros and cons of each method.
Apache CommonsJavaNumber Validation
0 likes · 16 min read

This article explains the Java BigDecimal class, its internal fields, and how its addition method scales numbers to maintain precision, illustrated with code examples and debugging insights, concluding that BigDecimal performs arithmetic using scaled long integers to avoid precision loss.
ArithmeticJavabigdecimal
0 likes · 6 min read


ITPUBMar 8, 2025 · Backend Development
The article explains how using double for monetary values can cause precision loss—turning 2.01 into 2.00—illustrates the binary representation issue, demonstrates failing code, and presents a robust solution using Java's BigDecimal with sample conversion methods and performance tests.
JavaMoneybigdecimal
0 likes · 6 min read

This article explains the Java BigDecimal class, its internal fields and methods, demonstrates a test case, and analyzes the add operation to show how scaling numbers to long integers preserves exact precision in financial calculations.
ArithmeticBackendFinancial
0 likes · 6 min read

This article explains why double precision numbers cannot represent many decimal values exactly, how BigDecimal achieves precise arithmetic through unscaled values and scale, and the proper ways to construct BigDecimal objects to avoid precision loss in Java applications.
bigdecimalfloating-pointprecision
0 likes · 10 min read

This guide explains why VARCHAR, float, and double are unsuitable for monetary values, and recommends using BIGINT/Long for cent‑level precision or BigDecimal/DECIMAL for higher precision, with practical tips and code examples for Java and MySQL.
Best PracticesJavaMonetary
0 likes · 6 min read

This article explains the differences between replace and replaceAll, how Integer caching affects equality checks, why constructing BigDecimal with double can cause precision loss, the nuances of string concatenation, the distinction between isEmpty and isBlank, when to check for null in MyBatis mapper results, and the correct way to use indexOf in Java.
IntegerSpring BootString
0 likes · 13 min read

This article explains why Java's BigDecimal can guarantee lossless precision in financial calculations by examining its class definition, internal fields, example usage, and the detailed implementation of its add method, including scaling and long‑integer arithmetic.
JavaNumber Handlingbackend development
0 likes · 7 min read

The article explains how Java's BigDecimal class avoids precision loss by scaling numbers into integer representations, detailing its internal fields, the add method's branching logic, and a concrete test that demonstrates exact decimal addition for financial values.
IntegerArithmeticJavabigdecimal
0 likes · 6 min read

This article explains how Java's BigDecimal class preserves decimal precision by scaling numbers to long integers, detailing its internal fields, key methods, and step‑by‑step execution of an addition example to illustrate the underlying algorithm.
ArithmeticBackendbigdecimal
0 likes · 7 min read

This article explains why Java's BigDecimal class ensures loss‑free precision in financial calculations by examining its internal fields, demonstrating usage with a test method, and walking through the add method's scaling logic and integer‑based computation.
BackendFinancialJava
0 likes · 6 min read

This article provides an in‑depth tutorial on Java's BigDecimal class—including its overview, constructors, common methods, formatting, exception handling, and utility wrappers—while also containing promotional material for ChatGPT subscription services and related community offers.
ArithmeticJavaTutorial
0 likes · 16 min read

This article explains six typical pitfalls when using Java's BigDecimal for precise calculations—such as initializing with floating‑point literals, neglecting scale in division, misusing equals, confusing scale with precision, ignoring immutability, and performance overhead—and provides clear code‑based solutions to each problem.
ArithmeticBest PracticesJava
0 likes · 7 min read

This article explains six typical pitfalls when using Java's BigDecimal—such as initializing with floating‑point literals, ignoring scale in division, misusing equals, misunderstanding scale, overlooking immutability, and performance costs—and provides clear code examples and best‑practice solutions to prevent precision loss and inefficiency.
ArithmeticJavabigdecimal
0 likes · 7 min read

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.
BackendJavaLong
0 likes · 2 min read

This article explains how Java's BigDecimal class maintains exact decimal precision by scaling numbers to integers, detailing its class structure, key methods, and a step‑by‑step example that demonstrates the internal addition algorithm.
ArithmeticJavabigdecimal
0 likes · 6 min read

This article explains how Java's BigDecimal class maintains exact decimal precision by scaling numbers to long integers, detailing its internal fields, demonstrating addition with sample code, and analyzing the underlying add method logic to show why no precision is lost.
ArithmeticBackendJava
0 likes · 6 min read

This article explains why using double for monetary values in Java can cause rounding errors such as 2.01 becoming 2.00, demonstrates the binary precision problem with sample code, and provides a robust BigDecimal‑based solution with performance testing.
bigdecimalfloating-pointmoney conversion
0 likes · 5 min read

This article explains why Java's BigDecimal maintains exact precision by examining its class fields, demonstrating a test example, and walking through the internal add method logic that scales numbers to long integers before performing arithmetic, ensuring loss‑free results.
ArithmeticBackendJava
0 likes · 6 min read

This article provides an in‑depth introduction to Java's BigDecimal class, covering its purpose for high‑precision arithmetic, frequently used constructors, essential arithmetic and conversion methods, comparison techniques, number‑formatting examples, common exceptions during division, and a utility class that encapsulates typical operations.
ArithmeticJavaUtility
0 likes · 14 min read

The article examines the long‑standing debate over using Long or BigDecimal to represent monetary amounts, presents ten community‑sourced approaches with visual illustrations, analyzes the underlying precision problem, and concludes with a recommendation favoring BigDecimal for accurate financial calculations.
Financial ComputingJavaLong
0 likes · 9 min read

This article explains why Java's BigDecimal class maintains exact precision by examining its internal fields, demonstrating usage through test code, and walking through the add method's implementation to show how values are scaled and computed as long integers before producing the final result.
ArithmeticJavabigdecimal
0 likes · 7 min read

The article outlines frequent Java pitfalls—including BigDecimal precision loss, immutable lists from Arrays.asList, double division by zero returning Infinity, null values in switch statements, stream filters mutating original objects, and autoboxing nulls causing NullPointerExceptions—and provides clear explanations and practical fixes to enhance code reliability.
Arrays.asListAutoboxingJava
0 likes · 5 min read

This article explains Java's BigDecimal class, covering its purpose for high‑precision arithmetic, common constructors, essential methods such as add, subtract, multiply, divide, comparison, formatting with NumberFormat, handling of division exceptions, and provides a utility class with static arithmetic operations for accurate calculations.
ArithmeticExceptionFormatting
0 likes · 15 min read

This article introduces Java's BigDecimal class, explains its purpose for high-precision arithmetic beyond double's limits, details constructors, common methods, formatting, comparison, and exception handling, and provides practical code examples and a utility class for accurate mathematical operations.
ArithmeticJavaNumberFormat
0 likes · 15 min read

This article explains the purpose, constructors, common methods, formatting techniques, and exception handling of Java's BigDecimal class, providing code examples and best‑practice recommendations for performing high‑precision calculations in Java applications.
ArithmeticJavabigdecimal
0 likes · 17 min read

This article explains Java's BigDecimal class, covering its purpose for high‑precision arithmetic, recommended constructors, key arithmetic methods, comparison techniques, formatting with NumberFormat, handling of division exceptions, and best‑practice tips such as using the String constructor and managing immutability.
ArithmeticExceptionFormatting
0 likes · 13 min read

Java's BigDecimal class offers arbitrary‑precision decimal arithmetic, requiring method calls like add, subtract, multiply, and divide instead of operators, and should be instantiated via String or valueOf to avoid double‑precision errors, with careful handling of scaling, rounding, formatting, and comparison for exact financial calculations.
ArithmeticJavaNumberFormat
0 likes · 14 min read

This article provides an in‑depth tutorial on Java's BigDecimal class, covering its purpose, common constructors, essential arithmetic methods, comparison techniques, formatting with NumberFormat, handling of division exceptions, and a utility class offering precise add, subtract, multiply, divide, rounding, and comparison operations.
ArithmeticExceptionHandlingFormatting
0 likes · 16 min read

This article explains the Java BigDecimal class, detailing its internal storage mechanisms, precision handling, immutable design, and common pitfalls, and provides best‑practice guidelines for constructing, comparing, dividing, and converting BigDecimal values to ensure accurate numerical computations.
Best PracticesImmutableJava
0 likes · 10 min read

The article explains how Java’s BigDecimal class maintains exact financial precision by storing numbers as an unscaled integer and a scale, scaling operands to a common decimal place, performing integer arithmetic—including handling differing scales—and finally reconstructing a correctly scaled result.
ArithmeticJavabigdecimal
0 likes · 7 min read

This article provides an in‑depth overview of Java's BigDecimal class, covering its purpose for high‑precision arithmetic, frequently used constructors, essential methods for arithmetic and conversion, techniques for formatting numbers, handling of common exceptions, and includes practical code examples and a utility class for precise calculations.
ArithmeticFormattingJava
0 likes · 16 min read

This article explains why using Java's BigDecimal for monetary values ensures precise, immutable, and correctly rounded calculations, compares it with float, double, long, and int, and provides best‑practice code examples for constructing, computing, and formatting financial numbers.
JavaMonetary Calculationsbigdecimal
0 likes · 8 min read

This article explains why Java's BigDecimal is essential for high‑precision arithmetic, outlines common use cases such as finance and scientific computing, highlights typical pitfalls with floating‑point numbers, and provides practical code examples and best‑practice tips for correct usage.
ArithmeticJavabigdecimal
0 likes · 8 min read

The article analyzes why a Java API endpoint took eight seconds, demonstrates through benchmarks that List.sort() outperforms Stream.sorted(), shows how sorting on computed columns and using BigDecimal can drastically slow execution, and presents three practical optimizations that reduce the response time to under a second.
Javabigdecimallist.sort
0 likes · 8 min read

This article explains Java's BigDecimal class, covering its purpose for high‑precision arithmetic, the most frequently used constructors, essential instance methods, comparison techniques, formatting with NumberFormat, handling of division exceptions, and a utility class that wraps common operations, all illustrated with concrete code examples.
ArithmeticFormattingJava
0 likes · 15 min read

This article provides an in‑depth tutorial on Java's BigDecimal class, covering its purpose for high‑precision arithmetic, common constructors, usage pitfalls, essential methods, number formatting with NumberFormat, handling of division exceptions, and a recommended utility class for precise calculations.
ArithmeticJavaNumberFormat
0 likes · 15 min read

This article explains Java's BigDecimal class for high‑precision arithmetic, covering its purpose, common constructors, usage examples, essential arithmetic and comparison methods, formatting techniques with NumberFormat, handling of division exceptions, and a summary of best practices with a utility class example.
ArithmeticFormattingJava
0 likes · 16 min read

This article provides a comprehensive guide to Java's BigDecimal class, covering its purpose for high‑precision arithmetic, common constructors, usage pitfalls with double values, essential methods, comparison techniques, formatting options, exception handling, and a utility class for everyday operations.
ArithmeticJavabackend development
0 likes · 19 min read

This article explains Java's BigDecimal class, covering its purpose for high‑precision arithmetic, common constructors, essential methods such as add, subtract, multiply, divide, formatting techniques, handling of non‑terminating decimals, and provides a utility class with examples and best‑practice recommendations for developers.
ArithmeticJavaMathbigdecimal
0 likes · 15 min read

This article explains why using Java's BigDecimal is essential for precise financial calculations, outlines four common pitfalls—including floating-point errors, equality comparison, scale handling, and string conversion—and provides practical best-practice solutions with code examples and rounding mode guidance.
Financial-CalculationsRoundingModebigdecimal
0 likes · 14 min read

This article explains Java's BigDecimal class, covering its constructors, precise arithmetic operations, formatting techniques, common pitfalls with double values, comparison methods, exception handling, and provides a utility class with comprehensive methods for accurate calculations.
ArithmeticExceptionJava
0 likes · 14 min read

This article highlights six frequent Java pitfalls—including misuse of == with Integer, Objects.equals quirks, BigDecimal precision loss, Stream filter side‑effects, auto‑unboxing null errors, and String replace nuances—providing code examples and best‑practice recommendations to help developers write safer, more reliable code.
Auto-unboxingJavaString
0 likes · 12 min read

This article explains why floating‑point numbers lose precision in binary representation, demonstrates the issue with Java float examples, and shows how to use the BigDecimal class—including creation, arithmetic operations, scaling, and proper equality comparison—to achieve exact decimal calculations in Java applications.
ArithmeticJavabigdecimal
0 likes · 8 min read

This article explains several common mistakes when using Java's BigDecimal—such as constructing it with a double, using valueOf, relying on equals for comparison, and misusing round—and provides correct alternatives like string constructors, valueOf with proper precision, compareTo, and setScale for reliable arithmetic.
Best PracticesJavaMath
0 likes · 6 min read

This article explains five common BigDecimal traps—including constructor precision loss, equals vs compareTo, division exceptions, string conversion quirks, and operation order—provides code examples, and recommends using the JSR‑354 Money API with Maven for safer monetary calculations in Java backend development.
BackendJSR 354Java
0 likes · 8 min read

This article explains why floating‑point types cause precision errors in financial calculations, reveals four common BigDecimal pitfalls—including constructor misuse, equality comparison, division precision, and string conversion—and provides concrete best‑practice solutions such as using String constructors, compareTo, specifying scale, and appropriate formatting methods.
Best PracticesFinancialJava
0 likes · 14 min read

This article explains six frequent Java pitfalls—including misuse of the == operator with Integer, subtle bugs in Objects.equals, precision loss with BigDecimal constructors, reference sharing in Stream.filter, NullPointerExceptions from autounboxing, and differences between replace, replaceAll, and replaceFirst—providing code examples and best‑practice recommendations.
AutoboxingJavaStringReplace
0 likes · 12 min read

This article walks Java developers through six frequent pitfalls—including misuse of the == operator, subtle bugs in Objects.equals, precision issues with BigDecimal, unexpected Stream filter behavior, autoboxing/unboxing surprises, and string replace quirks—offering clear explanations, code examples, and best‑practice solutions to help avoid costly bugs.
AutoboxingJavaString replace
0 likes · 13 min read

This article explains why using floating‑point types for monetary calculations can cause precision loss, demonstrates the problem with BigDecimal constructors, analyzes the underlying double‑to‑long conversion, and provides a utility class with safe BigDecimal operations for backend Java applications.
Financial-CalculationsUtilitybigdecimal
0 likes · 9 min read

This article analyzes a checkout‑system outage caused by BigDecimal precision loss, reproduces the bug with Java code, explains the underlying double‑to‑long conversion issue, and recommends using String‑based construction for accurate monetary calculations.
Financial-CalculationsJavabigdecimal
0 likes · 6 min read

This article examines a real‑world cash‑register failure caused by BigDecimal precision loss, explains why using double or float constructors leads to errors, demonstrates the problem with code samples, and provides a robust utility class for accurate monetary calculations in Java.
JavaMoneyUtility
0 likes · 9 min read

This article explains why using floating‑point types with BigDecimal can cause precision loss in financial calculations, demonstrates the problem with sample code, analyzes the underlying double‑to‑long conversion, and provides a reusable Java utility class to perform accurate arithmetic with BigDecimal.
FinancialJavaUtility
0 likes · 8 min read

This article provides a comprehensive guide to Java's BigDecimal class, covering its purpose for high‑precision arithmetic, recommended constructors, essential methods, formatting techniques, handling of non‑terminating division, and a reusable utility class for accurate mathematical operations.
ArithmeticJavaNumberFormatting
0 likes · 16 min read

This article explains why the java.math.BigDecimal(double) constructor can cause precision loss, recommends using the String constructor for monetary values, and advises comparing BigDecimal instances with compareTo instead of equals to avoid scale‑related mismatches.
Best PracticesJavabigdecimal
0 likes · 4 min read

This article explains Java's BigDecimal class, covering its purpose for high‑precision arithmetic, recommended constructors, essential methods, comparison techniques, formatting with NumberFormat, handling of division exceptions, and practical tips for efficient and accurate numeric computations.
ArithmeticExceptionJava
0 likes · 14 min read

This article provides an in‑depth overview of Java's BigDecimal class, covering its purpose for high‑precision arithmetic, essential constructors, key methods for addition, subtraction, multiplication, division, formatting techniques, common exceptions, and practical utility code examples.
ArithmeticExceptionFormatting
0 likes · 15 min read

This article explains why Java's BigDecimal class is essential for exact arithmetic beyond double's 16‑digit limit, details its constructors, common methods, formatting techniques, handling of division exceptions, and provides a utility class with high‑precision operations, all illustrated with clear code examples.
ArithmeticJavaNumberFormat
0 likes · 15 min read

This guide demonstrates how to use the Aviator 5.2.5 expression engine on Java 8 with practical examples covering ternary operators, regex matching, variable shortcuts, nil handling, date comparisons, big number calculations, the powerful seq library, execution modes, and debugging techniques.
Javabigdecimalexpression-engine
0 likes · 7 min read

This article reveals frequent JDK pitfalls such as missing null checks in String.valueOf, fragile Integer.parseInt conversions, BigDecimal division errors, unmodifiable Collections.emptyList, and unsafe list iteration, providing concrete code examples and safe handling recommendations for Java developers.
JDKJavabigdecimal
0 likes · 10 min read

This article walks through frequent Java string‑related mistakes—including misuse of replace vs replaceAll, Integer equality pitfalls, BigDecimal precision issues, StringBuilder versus String, isEmpty vs isBlank, MyBatis mapper null checks, and indexOf logic—providing clear explanations, code examples, and best‑practice recommendations.
MyBatisStringStringBuilder
0 likes · 13 min read

BigDecimal provides precise arithmetic in Java, but its correct usage requires understanding its internal unscaled value and scale, avoiding the inaccurate BigDecimal(double) constructor, and preferring String or valueOf methods to accurately represent decimal numbers such as 0.1 in financial and e‑commerce applications.
FinancialJavabigdecimal
0 likes · 9 min read

JavaScript’s 0.2 + 0.1 yielding 0.30000000000000004 stems from binary floating‑point representation, where many decimal fractions cannot be expressed exactly; the article explains decimal‑to‑binary conversion, the repeating binary of 0.1, IEEE‑754 format, and how to avoid precision loss using BigDecimal in Java.
IEEE 754JavaJavaScript
0 likes · 9 min read

This article explains why Java's BigDecimal.equals method compares both numeric value and scale, demonstrates common pitfalls with == and equals, shows experimental results for different constructors, and recommends using compareTo for value‑only comparisons to avoid unexpected false outcomes.
JavabigdecimalcompareTo
0 likes · 8 min read

This article explains Java's BigDecimal class, covering its purpose, constructors, common methods, formatting techniques, handling of non‑terminating division, and best‑practice recommendations, while providing clear code examples and practical tips for accurate high‑precision arithmetic.
ArithmeticExceptionHandlingNumberFormat
0 likes · 19 min read

This article explains how floating‑point arithmetic in Java leads to precision loss, shows that even BigDecimal can suffer the same issue when misused, and provides proper construction methods and a utility class to ensure accurate monetary calculations.
BackendJavaUtility
0 likes · 9 min read

This tutorial explains how to use Java's Stream API to sum numeric collections, demonstrates summing IntStream and DoubleStream values, and shows how to apply the reduce method to calculate sums for BigDecimal streams when a dedicated BigDecimalStream is unavailable.
JavaStream APISum
0 likes · 4 min read

The article explains why floating‑point arithmetic in Java loses precision, demonstrates how even BigDecimal can suffer when constructed from double values, and shows the correct practice of using the BigDecimal(String) constructor together with utility methods to perform accurate monetary calculations.
JavaMonetary Calculationsbigdecimal
0 likes · 9 min read

This article explains why using the float type for monetary values leads to precision loss due to binary representation, demonstrates the problem with a Java example, and recommends using integer cents, BigDecimal, or MySQL decimal to store amounts safely.
Financial-CalculationsJavaMySQL decimal
0 likes · 8 min read

This article explains how floating‑point calculations in Java can lose precision, especially for monetary values, and demonstrates using the BigDecimal class—particularly its String constructor—to achieve exact arithmetic in backend applications.
Javabackend developmentbigdecimal
0 likes · 7 min read

This article explains why commercial calculations should use Java's BigDecimal for exact decimal arithmetic, details its structure, shows how to construct instances safely, covers common API methods, rounding modes, number formatting, and provides practical code examples.
APIArithmeticJava
0 likes · 12 min read

This article examines the floating‑point nature of Redis ZSET scores, the precision limits of Java double values, how Redis stores and retrieves these scores, and practical guidelines for avoiding precision loss when using timestamps or large numeric scores in backend development.
RedisSCoReZSet
0 likes · 5 min read

This article explains the purpose and internal representation of Java's BigDecimal, demonstrates various ways to create instances, walks through key parts of its source code, highlights common pitfalls, and provides a utility class for precise arithmetic operations.
BackendJavaUtility
0 likes · 11 min read

This article presents five Java code snippets—covering floating‑point comparison, wrapper equality, switch handling of null, BigDecimal construction, and lock usage—and challenges readers to identify the correct outcomes, exposing common misconceptions and best‑practice solutions.
ConcurrencyInterview questionsbigdecimal
0 likes · 4 min read
