mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Fix bug where (float)"infi" did not produce Infinity.
This commit is contained in:
parent
42ac090f03
commit
1440f7811e
1 changed files with 4 additions and 1 deletions
|
@ -32,6 +32,9 @@ from base64 import b64encode, b64decode
|
|||
# The lookahead (?!i) is essential for parsing them that way without extra code.
|
||||
# Note that '|' in REs is order-sensitive.
|
||||
float_re = re.compile(ur'^\s*[+-]?(?:0(x)(?:[0-9a-f]+(?:\.[0-9a-f]*)?|\.[0-9a-f]+)(?:p[+-]?[0-9]+)?'
|
||||
ur'|(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:e[+-]?[0-9]+)?|inf|nan)',
|
||||
re.I)
|
||||
vfloat_re = re.compile(ur'^\s*[+-]?(?:0(x)(?:[0-9a-f]+(?:\.[0-9a-f]*)?|\.[0-9a-f]+)(?:p[+-]?[0-9]+)?'
|
||||
ur'|(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:e[+-]?[0-9]+)?|infinity|inf(?!i)|nan)',
|
||||
re.I)
|
||||
|
||||
|
@ -329,7 +332,7 @@ def InternalTypecast(val, out, InList, f32):
|
|||
return Z
|
||||
val = val[1:]
|
||||
for _ in range(dim):
|
||||
match = float_re.match(val)
|
||||
match = vfloat_re.match(val)
|
||||
if match is None:
|
||||
return Z
|
||||
if match.group(1):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue