mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 07:38:21 +00:00
Fix crash in conversion to string for floats < 1e-13
Fixes part of #17. Reported by SaladDais@users.noreply.github.com, thanks!
This commit is contained in:
parent
c29475d072
commit
7c630f4ce4
1 changed files with 4 additions and 0 deletions
|
@ -386,6 +386,10 @@ def f2s(val, DP=6):
|
|||
sgn = u'-' if s[0] == u'-' else u''
|
||||
if sgn: s = s[1:]
|
||||
|
||||
# If we don't have significant digits, return zero
|
||||
if s == '0.' + '0'*(DP+7):
|
||||
return sgn + s[:DP+2]
|
||||
|
||||
# Look for position of first nonzero from the left
|
||||
i = 0
|
||||
while s[i] in u'0.':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue