eslint-plugin-big-number-rules: Enforce finance-safe calculations (helps 0.1 + 0.2 really equal 0.3)

This page summarizes the projects mentioned and recommended in the original post on /r/javascript

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • 0.30000000000000004

    Floating Point Math Examples

  • This is the classic example and is often cited, but there are other rare corner-cases that can eventually bite you.

  • bignumber.js

    A JavaScript library for arbitrary-precision decimal and non-decimal arithmetic

  • If you use floating-points for currency (instead of whole-numbers like you probably should) libraries like bignumber.js help keep your code away from the binary floating-point pitfalls of IEEE-754 which manifests in the standard JavaScript number type:

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • eslint-plugin-big-number-rules

    Enforce (or automatically fix) finance-safe calculations using BigNumber or similar libraries.

  • And they did bite me, so I wrote this eslint plugin to help out a FinTech app that was experiencing a number of such bugs.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts