You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is, 0.3 has no precise representation in binary floating point - its closest representable value is 2.99999999999999988898e-01. But in this case, it's read as 0.30000000000000004 instead, which is the value to be found within GeoIP2-Static-IP-Score-Test.mmdb.
I boiled the issue down to what's (presumably) a bug in the Cpanel::JSON::XS library, which is used to decode the JSON sources.
Here's a small perl script that reproduces the issue:
In a specific case under GeoIP2-Static-IP-Score-Test.json, recently modified in order to use floating point values, the JSON value
0.3
is corrupted when generating MMDB test data.The problem is,
0.3
has no precise representation in binary floating point - its closest representable value is2.99999999999999988898e-01
. But in this case, it's read as0.30000000000000004
instead, which is the value to be found withinGeoIP2-Static-IP-Score-Test.mmdb
.I boiled the issue down to what's (presumably) a bug in the Cpanel::JSON::XS library, which is used to decode the JSON sources.
Here's a small perl script that reproduces the issue:
It outputs
-5.55111512312578e-17
. Mind. Blowing.The text was updated successfully, but these errors were encountered: