Safe comparison with 0
error: comparing floating point with == or != is unsafe [-Werror=float-equal]
This commit is contained in:
parent
3048707930
commit
07ae5af8b3
@ -800,7 +800,7 @@ class numeric : public schema
|
|||||||
{
|
{
|
||||||
T value = instance; // conversion of json to value_type
|
T value = instance; // conversion of json to value_type
|
||||||
|
|
||||||
if (multipleOf_.first && value != 0) // zero is multiple of everything
|
if (multipleOf_.first && ((value < 0) || (value > 0))) // zero is multiple of everything
|
||||||
if (violates_multiple_of(value))
|
if (violates_multiple_of(value))
|
||||||
e.error(ptr, instance, "instance is not a multiple of " + std::to_string(multipleOf_.second));
|
e.error(ptr, instance, "instance is not a multiple of " + std::to_string(multipleOf_.second));
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user