pydantic / jiter

Fast iterable JSON parser.
https://crates.io/crates/jiter
MIT License
182 stars 11 forks source link

lossless float support #98

Closed samuelcolvin closed 3 months ago

samuelcolvin commented 3 months ago

fix #80.

Example usage:

import jiter

f = jiter.from_json(b'123.456789123456789e45', lossless_floats=True)
assert isinstance(f, jiter.LosslessFloat)
assert 123e45 < float(f) < 124e45
assert f.as_decimal() == Decimal('1.23456789123456789E+47')
assert bytes(f) == b'123.456789123456789e45'
assert str(f) == '123.456789123456789e45'
assert repr(f) == 'LosslessFloat(123.456789123456789e45)'
codspeed-hq[bot] commented 3 months ago

CodSpeed Performance Report

Merging #98 will not alter performance

Comparing py-float (9ed4360) with main (1fbedbf)

Summary

✅ 73 untouched benchmarks