<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/tests/float/float_parse.py, branch 6.0.0</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=6.0.0</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=6.0.0'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2018-05-21T03:05:40+00:00</updated>
<entry>
<title>tests: Add some tests for bigint hash, float hash and float parsing.</title>
<updated>2018-05-21T03:05:40+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-05-21T03:05:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=1ad0013decb42418ca667c2d9994198b537fa778'/>
<id>urn:sha1:1ad0013decb42418ca667c2d9994198b537fa778</id>
<content type='text'>
Following outcome of recent fuzz testing and sanitizing by @jepler.
</content>
</entry>
<entry>
<title>tests/float/float_parse: Allow test to run on 32-bit archs.</title>
<updated>2018-05-11T03:51:18+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-05-11T03:51:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=d2c1db1e5cca03c9a34614af6d12045aefe3d719'/>
<id>urn:sha1:d2c1db1e5cca03c9a34614af6d12045aefe3d719</id>
<content type='text'>
Printing of uPy floats can differ by the floating-point precision on
different architectures (eg 64-bit vs 32-bit x86), so it's not possible to
using printing of floats in some parts of this test.  Instead we can just
check for equivalence with what is known to be the correct answer.
</content>
</entry>
<entry>
<title>tests/float: Adjust float-parsing tests to pass with only a small error.</title>
<updated>2018-02-26T04:54:03+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-02-26T04:54:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=6dad0885692f8d1e743873fb4be241f1fd1cb91a'/>
<id>urn:sha1:6dad0885692f8d1e743873fb4be241f1fd1cb91a</id>
<content type='text'>
Float parsing (both single and double precision) may have a relative error
of order the floating point precision, so adjust tests to take this into
account by not printing all of the digits of the answer.
</content>
</entry>
<entry>
<title>py/parsenum: Fix parsing of floats that are close to subnormal.</title>
<updated>2018-02-08T03:02:50+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-02-08T03:02:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=b75cb8392bdf5f8c12072eac3adbdaad53d1e8d2'/>
<id>urn:sha1:b75cb8392bdf5f8c12072eac3adbdaad53d1e8d2</id>
<content type='text'>
Prior to this patch, a float literal that was close to subnormal would
have a loss of precision when parsed.  The worst case was something like
float('10000000000000000000e-326') which returned 0.0.
</content>
</entry>
<entry>
<title>py/parsenum: Improve parsing of floating point numbers.</title>
<updated>2017-11-27T01:51:52+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-11-27T01:51:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=84895f1a210d0037a86887f0f647570bdf40afa2'/>
<id>urn:sha1:84895f1a210d0037a86887f0f647570bdf40afa2</id>
<content type='text'>
This patch improves parsing of floating point numbers by converting all the
digits (integer and fractional) together into a number 1 or greater, and
then applying the correct power of 10 at the very end.  In particular the
multiple "multiply by 0.1" operations to build a fraction are now combined
together and applied at the same time as the exponent, at the very end.

This helps to retain precision during parsing of floats, and also includes
a check that the number doesn't overflow during the parsing.  One benefit
is that a float will have the same value no matter where the decimal point
is located, eg 1.23 == 123e-2.
</content>
</entry>
</feed>
