-
-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
From src/python_minifier/transforms/constant_folding.py
, lines 51-54:
if isinstance(original_value, float) and math.isnan(original_value):
# There is no nan literal.
# we could use float('nan'), but that complicates folding as it's not a Constant
return node
NaN values do actually have a representation, at least in all the Python versions that I tested (3.9 through 3.12):
>>> ast.unparse(ast.Constant(float("nan")))
'(1e309-1e309)'
This is because inf - inf = nan
and 1e309
is inf
.
Should be an easy fix, but I don't know if Python 2 supports the same thing so I didn't want to send a PR myself.
Metadata
Metadata
Assignees
Labels
No labels