aprescott / ruby-inexact_equality_warning

You do not want to compare floating point numbers for equality

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

x = 1.0 - 0.9 - 0.1
x == 0.0
# WARNING: Testing for equality with inexact floats is ill-advised, when comparing -2.7755575615628914e-17 and 0 (/path/to/file.rb:123)
# => false

Installation and usage

Gemfile:

gem "inexact_equality_warning"
require "inexact_equality_warning"

About

You do not want to compare floating point numbers for equality

License:MIT License


Languages

Language:Ruby 100.0%