Skip to content

Commit

Permalink
Fix passing backend FPV objects to math.isnan and math.isinf (#572)
Browse files Browse the repository at this point in the history
  • Loading branch information
twizmwazin authored Nov 19, 2024
1 parent 89e104b commit 4d5cb00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions claripy/backends/backend_concrete/fp.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,11 @@ def fpIsNaN(x):
"""
Checks whether the argument is a floating point NaN.
"""
return math.isnan(x)
return math.isnan(x.value)


def fpIsInf(x):
"""
Checks whether the argument is a floating point infinity.
"""
return math.isinf(x)
return math.isinf(x.value)
6 changes: 6 additions & 0 deletions tests/test_fp.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ def test_fp_precision_loss(self):
assert edd != edd2
assert edd2 == 0x4237B4C7C0000000

def test_concrete_isnan(self):
assert claripy.FPV(0, claripy.FSORT_FLOAT).isNaN() is claripy.false()

def test_concrete_isinf(self):
assert claripy.FPV(0, claripy.FSORT_FLOAT).isInf() is claripy.false()


if __name__ == "__main__":
unittest.main()

0 comments on commit 4d5cb00

Please sign in to comment.