Skip to content

Commit 680b159

Browse files
Dorian BirrauxRaj Balaebail
authored andcommitted
Negative exponent is dropped when deserializing big reals
1 parent 22e06ef commit 680b159

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

wolframclient/deserializers/wxf/wxfconsumer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def consume_bigint(self, current_token, tokens, **kwargs):
154154
except ValueError:
155155
raise WolframParserException("Invalid big integer value: %s" % current_token.data)
156156

157-
BIGREAL_RE = re.compile(r"([^`]+)(`[0-9.]+){0,1}(\*\^[0-9]+){0,1}")
157+
BIGREAL_RE = re.compile(r"([^`]+)(`[0-9.]+){0,1}(\*\^){0,1}(-?[0-9]+){0,1}")
158158

159159
def consume_bigreal(self, current_token, tokens, **kwargs):
160160
"""Parse a WXF big real as a WXF serializable big real.
@@ -169,10 +169,10 @@ def consume_bigreal(self, current_token, tokens, **kwargs):
169169

170170
if match:
171171

172-
num, prec, exp = match.groups()
172+
num, prec, pow, exp = match.groups()
173173

174174
if exp:
175-
return decimal.Decimal("%se%s" % (num, exp[2:]))
175+
return decimal.Decimal("%se%s" % (num, exp))
176176

177177
return decimal.Decimal(num)
178178

0 commit comments

Comments
 (0)