Now preserving distinction between ints and floats

This commit is contained in:
panasenco
2021-04-20 19:59:01 -07:00
parent 7e802706fe
commit d3caba4073
3 changed files with 24 additions and 3 deletions

View File

@@ -226,7 +226,11 @@ json_number(Number) -->
json_integer(Integer),
json_fraction(Fraction),
json_exponent(Exponent),
{ Number is Sign * (Integer + Fraction) * 10.0 ^ Exponent }.
{ ( Exponent >= 0 ->
Base = 10
; Base = 10.0
),
Number is Sign * (Integer + Fraction) * Base ^ Exponent }.
json_integer(Digit) --> json_digit(Digit).
json_integer(TotalValue) -->