mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
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:
parent
4ec9396688
commit
2cf5ede817
1 changed files with 4 additions and 0 deletions
|
@ -70,9 +70,13 @@ class outscript(object):
|
||||||
if tvalue == float:
|
if tvalue == float:
|
||||||
if self.optfloats and value.is_integer() and -2147483648.0 <= value < 2147483648.0:
|
if self.optfloats and value.is_integer() and -2147483648.0 <= value < 2147483648.0:
|
||||||
if self.globalmode and not self.listmode:
|
if self.globalmode and not self.listmode:
|
||||||
|
if value == 0 and math.copysign(1, value) == -1:
|
||||||
|
return '-0.'
|
||||||
return str(int(value))
|
return str(int(value))
|
||||||
elif not self.globalmode:
|
elif not self.globalmode:
|
||||||
# Important inside lists!!
|
# Important inside lists!!
|
||||||
|
if value == 0 and math.copysign(1, value) == -1:
|
||||||
|
return '(-(float)0)'
|
||||||
return '((float)' + str(int(value)) + ')'
|
return '((float)' + str(int(value)) + ')'
|
||||||
s = repr(value)
|
s = repr(value)
|
||||||
if s == 'nan':
|
if s == 'nan':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue