mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
It's possible to enter Infinity as a float constant, so do that rather than the (float)"inf" kludge. It remains for NaN though.
This commit is contained in:
parent
881a33a427
commit
c555a01a48
2 changed files with 9 additions and 5 deletions
|
@ -71,8 +71,13 @@ class outscript(object):
|
|||
# Important inside lists!!
|
||||
return '((float)' + str(int(value)) + ')'
|
||||
s = repr(value)
|
||||
if s in ('inf', '-inf', 'nan'):
|
||||
if s == 'nan':
|
||||
return '((float)"' + s + '")' # this shouldn't appear in globals
|
||||
if s in ('inf', '-inf'):
|
||||
s = '1e40' if s == 'inf' else '-1e40'
|
||||
if self.globalmode:
|
||||
return s
|
||||
return '((float)' + s + ')'
|
||||
# Try to remove as many decimals as possible but keeping the F32 value intact
|
||||
exp = s.find('e')
|
||||
if ~exp:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue