Damien George
6b8b56f859
py/modmath: Check for zero division in log with 2 args.
2017-07-04 02:15:11 +10:00
Damien George
6ed4581f54
py/formatfloat: Fix number of digits and exponent sign when rounding.
...
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
2017-06-13 13:36:56 +10:00
Paul Sokolovsky
e094200750
tests/float/builtin_float_minmax: PEP8 fixes.
2017-06-08 17:23:22 +03:00
Damien George
fde54350a8
tests/float: Convert "sys.exit()" to "raise SystemExit".
...
The latter is shorter and simpler because it doesn't require importing the
sys module.
2017-06-08 14:00:57 +10:00
Damien George
677fb31015
tests/float: Add tests for hashing float and complex numbers.
2017-04-04 12:14:34 +10:00
Paul Sokolovsky
28876d3902
tests/float/byte*_construct: Skip on missing array module.
2017-04-03 00:17:43 +03:00
Damien George
bfb48c1620
tests/float: Add tests for round() of inf, nan and large number.
2017-03-24 11:00:45 +11:00
Damien George
bacb52aa2d
tests/float: Add tests for math funcs that return ints.
...
One should test bigint, inf and nan to make sure all cases are covered.
2017-03-23 23:54:10 +11:00
Paul Sokolovsky
a0cbc108ba
tests/float: Make various tests skippable.
2017-03-09 00:11:05 +01:00
Paul Sokolovsky
88ffe0d5cc
tests/string_format_modulo2: Split off intbig test.
2017-03-07 00:13:36 +01:00
Paul Sokolovsky
4b03941f5e
tests/float2int*: Suffix with _intbig, don't run on any other int type.
...
I.e. they don't run successfully with MICROPY_LONGINT_IMPL_NONE
and MICROPY_LONGINT_IMPL_LONGLONG (the problem is that they generate
different output than CPython, TODO to fix that).
2017-03-06 16:30:12 +01:00
Paul Sokolovsky
121fb88988
float/float2int*: Make actually be parsable for MICROPY_LONGINT_IMPL_NONE.
...
The use of large literal numbers is a big no-no when it comes to writing
programs which work with different int representations. Also, some checks
are pretty adhoc (e.g using struct module to check for 64-bitness). This
change bases entire detection on sys.maxsize and integer operarions, and
thus more correct, even if longer.
Note that this change doesn't mean that any of these tests can pass with
anything but MPZ - even despite checking for various int representations,
the tests aren't written to be portable among them.
2017-03-06 16:23:09 +01:00
Paul Sokolovsky
325c4473a5
tests/float/complex1: Split out intbig test.
2017-03-06 15:46:01 +01:00
Damien George
8a39e18f5f
tests/float: Add tests for zero to a negative power.
2017-02-03 00:04:13 +11:00
Damien George
213a718953
tests/float: Add test for assigning to attribute of complex number.
2017-01-19 23:37:21 +11:00
Rami Ali
64dc925c4a
tests/float: Improve formatfloat.c test coverage using Python.
2017-01-05 12:31:05 +11:00
Rami Ali
531c206e8b
tests: Add tests to improve coverage of runtime.c.
2016-12-21 15:44:41 +11:00
Damien George
49bf7617d0
tests/float/builtin_float_round: Test round() with second arg.
2016-12-20 14:01:10 +11:00
Damien George
290daa15d9
tests/float: Add test for parsing a float from an empty string.
2016-09-27 15:44:56 +10:00
Damien George
e1e7657277
py/formatfloat: Fix further cases of buffer overflow in formatting.
...
Includes extensive test cases to catch hopefully all cases where
buffer might overflow.
2016-03-29 22:07:15 +01:00
Damien George
cea6cf8a5e
py/formatfloat: Fix buffer overflow when formatting tiny numbers.
2016-03-15 12:21:56 +00:00
Paul Sokolovsky
d973c1bc12
test/string_format_fp30: Variant of string_format for 30-bit stuffed float.
2016-03-06 06:10:40 +02:00
Paul Sokolovsky
50e0a7b9d4
test/float2int_fp30: Variant of float2int for 30-bit stuffed float.
2016-03-06 06:08:38 +02:00
Paul Sokolovsky
d4315a6caf
float/string_format: Split large test in 2.
2016-02-13 17:18:55 +02:00
Paul Sokolovsky
dc587a3623
test/float2int: Make test output clearer.
2016-02-13 17:03:02 +02:00