<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/tests/float, branch 3.0.0-rc.0</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=3.0.0-rc.0</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=3.0.0-rc.0'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2017-10-10T05:01:13+00:00</updated>
<entry>
<title>py/formatfloat: Don't print the negative sign of a NaN value.</title>
<updated>2017-10-10T05:01:13+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-10-04T12:15:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=08a196697c5dfb8cbe3b3e85c1c5f94e3a27804c'/>
<id>urn:sha1:08a196697c5dfb8cbe3b3e85c1c5f94e3a27804c</id>
<content type='text'>
NaN may have the sign bit set but it has no meaning, so don't print it out.
</content>
</entry>
<entry>
<title>py/modmath: Add full checks for math domain errors.</title>
<updated>2017-10-10T04:57:45+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-10-04T10:00:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=25e140652b946e9a136a16a9831c0b18f1285702'/>
<id>urn:sha1:25e140652b946e9a136a16a9831c0b18f1285702</id>
<content type='text'>
This patch changes how most of the plain math functions are implemented:
there are now two generic math wrapper functions that take a pointer to a
math function (like sin, cos) and perform the necessary conversion to and
from MicroPython types.  This helps to reduce code size.  The generic
functions can also check for math domain errors in a generic way, by
testing if the result is NaN or infinity combined with finite inputs.

The result is that, with this patch, all math functions now have full
domain error checking (even gamma and lgamma) and code size has decreased
for most ports.  Code size changes in bytes for those with the math module
are:

   unix x64:  -432
unix nanbox:  -792
      stm32:   -88
    esp8266:   +12

Tests are also added to check domain errors are handled correctly.
</content>
</entry>
<entry>
<title>py/objfloat: Support raising a negative number to a fractional power.</title>
<updated>2017-09-26T02:57:51+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-09-26T02:57:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=bdc6e86e079dd8a82e9ead1d4041c2e17c882437'/>
<id>urn:sha1:bdc6e86e079dd8a82e9ead1d4041c2e17c882437</id>
<content type='text'>
This returns a complex number, following CPython behaviour.  For ports that
don't have complex numbers enabled this will raise a ValueError which gives
a fail-safe for scripts that were written assuming complex numbers exist.
</content>
</entry>
<entry>
<title>py/obj: Fix comparison of float/complex NaN with itself.</title>
<updated>2017-09-04T04:16:27+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-09-04T04:16:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=d4b75f6b6822885e331c69a74e56e23af40a6264'/>
<id>urn:sha1:d4b75f6b6822885e331c69a74e56e23af40a6264</id>
<content type='text'>
IEEE floating point is specified such that a comparison of NaN with itself
returns false, and Python respects these semantics.  This patch makes uPy
also have these semantics.  The fix has a minor impact on the speed of the
object-equality fast-path, but that seems to be unavoidable and it's much
more important to have correct behaviour (especially in this case where
the wrong answer for nan==nan is silently returned).
</content>
</entry>
<entry>
<title>py/objfloat: Fix binary ops with incompatible objects.</title>
<updated>2017-09-02T20:05:24+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-09-02T18:19:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=9950865c39044e9fef295d0676af7c5fd55289ea'/>
<id>urn:sha1:9950865c39044e9fef295d0676af7c5fd55289ea</id>
<content type='text'>
These are now returned as "operation not supported" instead of raising
TypeError. In particular, this fixes equality for float vs incompatible
types, which now properly results in False instead of exception. This
also paves the road to support reverse operation (e.g. __radd__) with
float objects.

This is achieved by introducing mp_obj_get_float_maybe(), similar to
existing mp_obj_get_int_maybe().
</content>
</entry>
<entry>
<title>py: Implement raising a big-int to a negative power.</title>
<updated>2017-07-25T01:49:22+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-07-25T01:49:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=04552ff71b6c722b21597d93481f024c72457cef'/>
<id>urn:sha1:04552ff71b6c722b21597d93481f024c72457cef</id>
<content type='text'>
Before this patch raising a big-int to a negative power would just return
0.  Now it returns a floating-point number with the correct value.
</content>
</entry>
<entry>
<title>py/modmath: Check for zero division in log with 2 args.</title>
<updated>2017-07-03T16:15:11+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-07-03T16:15:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=6b8b56f8596d3dde544a72d037e9feddd9f70938'/>
<id>urn:sha1:6b8b56f8596d3dde544a72d037e9feddd9f70938</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/formatfloat: Fix number of digits and exponent sign when rounding.</title>
<updated>2017-06-13T03:36:56+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-06-13T03:36:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=6ed4581f545069488446682ee9b052798626327d'/>
<id>urn:sha1:6ed4581f545069488446682ee9b052798626327d</id>
<content type='text'>
This patch fixes 2 things when printing a floating-point number that
requires rounding up of the mantissa:
- retain the correct precision; eg 0.99 becomes 1.0, not 1.00
- if the exponent goes from -1 to 0 then render it as +0, not -0
</content>
</entry>
<entry>
<title>tests/float/builtin_float_minmax: PEP8 fixes.</title>
<updated>2017-06-08T14:23:22+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-06-08T14:23:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=e09420075017423f17073347eacad45ef4d3b860'/>
<id>urn:sha1:e09420075017423f17073347eacad45ef4d3b860</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tests/float: Convert "sys.exit()" to "raise SystemExit".</title>
<updated>2017-06-08T04:00:57+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-06-08T04:00:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=fde54350a8d740308d12c2ea4c65fa5bea4f186a'/>
<id>urn:sha1:fde54350a8d740308d12c2ea4c65fa5bea4f186a</id>
<content type='text'>
The latter is shorter and simpler because it doesn't require importing the
sys module.
</content>
</entry>
</feed>
