Fix optimization of -0.0.
It was optimized to ((float)0) because integers are cheaper. But that loses the sign, so that needed to be fixed.
This commit is contained in:
@@ -70,9 +70,13 @@ class outscript(object):
|
||||
if tvalue == float:
|
||||
if self.optfloats and value.is_integer() and -2147483648.0 <= value < 2147483648.0:
|
||||
if self.globalmode and not self.listmode:
|
||||
if value == 0 and math.copysign(1, value) == -1:
|
||||
return '-0.'
|
||||
return str(int(value))
|
||||
elif not self.globalmode:
|
||||
# Important inside lists!!
|
||||
if value == 0 and math.copysign(1, value) == -1:
|
||||
return '(-(float)0)'
|
||||
return '((float)' + str(int(value)) + ')'
|
||||
s = repr(value)
|
||||
if s == 'nan':
|
||||
|
||||
Reference in New Issue
Block a user