📝 addressed #514
NaN values never compare equal to themselves or to other NaN values.
This commit is contained in:
parent
19cd206d99
commit
62dfdf3f5d
2 changed files with 14 additions and 6 deletions
10
src/json.hpp
10
src/json.hpp
|
@ -5640,7 +5640,7 @@ class basic_json
|
||||||
@ref push_back(const typename object_t::value_type&). Otherwise, @a init
|
@ref push_back(const typename object_t::value_type&). Otherwise, @a init
|
||||||
is converted to a JSON value and added using @ref push_back(basic_json&&).
|
is converted to a JSON value and added using @ref push_back(basic_json&&).
|
||||||
|
|
||||||
@param init an initializer list
|
@param[in] init an initializer list
|
||||||
|
|
||||||
@complexity Linear in the size of the initializer list @a init.
|
@complexity Linear in the size of the initializer list @a init.
|
||||||
|
|
||||||
|
@ -6117,13 +6117,17 @@ class basic_json
|
||||||
|
|
||||||
Compares two JSON values for equality according to the following rules:
|
Compares two JSON values for equality according to the following rules:
|
||||||
- Two JSON values are equal if (1) they are from the same type and (2)
|
- Two JSON values are equal if (1) they are from the same type and (2)
|
||||||
their stored values are the same.
|
their stored values are the same according to their respective
|
||||||
|
`operator==`.
|
||||||
- Integer and floating-point numbers are automatically converted before
|
- Integer and floating-point numbers are automatically converted before
|
||||||
comparison. Floating-point numbers are compared indirectly: two
|
comparison. Floating-point numbers are compared indirectly: two
|
||||||
floating-point numbers `f1` and `f2` are considered equal if neither
|
floating-point numbers `f1` and `f2` are considered equal if neither
|
||||||
`f1 > f2` nor `f2 > f1` holds.
|
`f1 > f2` nor `f2 > f1` holds. Note than two NaN values are always
|
||||||
|
treated as unequal.
|
||||||
- Two JSON null values are equal.
|
- Two JSON null values are equal.
|
||||||
|
|
||||||
|
@note NaN values never compare equal to themselves or to other NaN values.
|
||||||
|
|
||||||
@param[in] lhs first JSON value to consider
|
@param[in] lhs first JSON value to consider
|
||||||
@param[in] rhs second JSON value to consider
|
@param[in] rhs second JSON value to consider
|
||||||
@return whether the values @a lhs and @a rhs are equal
|
@return whether the values @a lhs and @a rhs are equal
|
||||||
|
|
|
@ -5640,7 +5640,7 @@ class basic_json
|
||||||
@ref push_back(const typename object_t::value_type&). Otherwise, @a init
|
@ref push_back(const typename object_t::value_type&). Otherwise, @a init
|
||||||
is converted to a JSON value and added using @ref push_back(basic_json&&).
|
is converted to a JSON value and added using @ref push_back(basic_json&&).
|
||||||
|
|
||||||
@param init an initializer list
|
@param[in] init an initializer list
|
||||||
|
|
||||||
@complexity Linear in the size of the initializer list @a init.
|
@complexity Linear in the size of the initializer list @a init.
|
||||||
|
|
||||||
|
@ -6117,13 +6117,17 @@ class basic_json
|
||||||
|
|
||||||
Compares two JSON values for equality according to the following rules:
|
Compares two JSON values for equality according to the following rules:
|
||||||
- Two JSON values are equal if (1) they are from the same type and (2)
|
- Two JSON values are equal if (1) they are from the same type and (2)
|
||||||
their stored values are the same.
|
their stored values are the same according to their respective
|
||||||
|
`operator==`.
|
||||||
- Integer and floating-point numbers are automatically converted before
|
- Integer and floating-point numbers are automatically converted before
|
||||||
comparison. Floating-point numbers are compared indirectly: two
|
comparison. Floating-point numbers are compared indirectly: two
|
||||||
floating-point numbers `f1` and `f2` are considered equal if neither
|
floating-point numbers `f1` and `f2` are considered equal if neither
|
||||||
`f1 > f2` nor `f2 > f1` holds.
|
`f1 > f2` nor `f2 > f1` holds. Note than two NaN values are always
|
||||||
|
treated as unequal.
|
||||||
- Two JSON null values are equal.
|
- Two JSON null values are equal.
|
||||||
|
|
||||||
|
@note NaN values never compare equal to themselves or to other NaN values.
|
||||||
|
|
||||||
@param[in] lhs first JSON value to consider
|
@param[in] lhs first JSON value to consider
|
||||||
@param[in] rhs second JSON value to consider
|
@param[in] rhs second JSON value to consider
|
||||||
@return whether the values @a lhs and @a rhs are equal
|
@return whether the values @a lhs and @a rhs are equal
|
||||||
|
|
Loading…
Reference in a new issue