Fix isfinite to return false for NaN (#3510)
`isfinite` checked only for infinities, so `nan | isfinite` was true and `finites` let NaN through. A finite number is neither infinite nor NaN, as in C's `isfinite`, `Number.isFinite` and `math.isfinite`.
This commit is contained in:
4 files changed
+17
-4
No files matched your search
+1
-1
@@ -51,7 +51,7 @@ def index($i): indices($i) | .[0]; # TODO: optimize
|
||||
def rindex($i): indices($i) | .[-1:][0]; # TODO: optimize
|
||||
def paths: path(recurse)|select(length > 0);
|
||||
def paths(node_filter): path(recurse|select(node_filter))|select(length > 0);
|
||||
def isfinite: type == "number" and (isinfinite | not);
|
||||
def isfinite: type == "number" and (isinfinite | not) and (isnan | not);
|
||||
def arrays: select(type == "array");
|
||||
def objects: select(type == "object");
|
||||
def iterables: select(type|. == "array" or . == "object");
|
||||
|
||||
Reference in new issue
Block a user