Why should you not compare floats directly for equality?

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

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • Money

    PHP implementation of Fowler's Money pattern.

  • Or you can use MoneyPHP, which uses BCMath, and it takes care of all of your problems.

  • 0.30000000000000004

    Floating Point Math Examples

  • Floating point numbers, or floats, are stored as approximate binary fractions, which can cause rounding errors when compared for equality. This means that the values may not be exactly equal, leading to unexpected results. This is not specific to PHP - it is a characteristic of floating point numbers in general. Take a look: https://0.30000000000000004.com

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
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

  • Should I store the total price of an order or re-calculate it on-demand every time?

    1 project | /r/laravel | 23 Oct 2022
  • Need help with decimal and float type in Laravel API.

    1 project | /r/laravel | 2 Jul 2022
  • Trying to create a interface to abstract moneyPHP lib usage

    1 project | /r/PHPhelp | 15 Nov 2021
  • MoneyPHP 4.0 released - it's PHP 8 compatible!

    3 projects | /r/PHP | 27 May 2021
  • Handle all the hard stuff related to EU MOSS tax/vat regulations, the way it should be. Fork of mpociot/vat-calculator, standalone, PHP 7.3+, modernized, with more features.

    1 project | /r/PHP | 3 Jan 2021