summaryrefslogtreecommitdiffstatshomepage
path: root/py/formatfloat.c
Commit message (Collapse)AuthorAge
* all: Use the name MicroPython consistently in commentsAlexander Steffen2017-07-31
| | | | | There were several different spellings of MicroPython present in comments, when there should be only one.
* all: Remove trailing spaces, per coding conventions.Damien George2017-07-19
|
* py,extmod: Some casts and minor refactors to quiet compiler warnings.Tom Collins2017-07-07
|
* py/formatfloat: Fix number of digits and exponent sign when rounding.Damien George2017-06-13
| | | | | | | 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
* py/formatfloat: Remove unreachable code.Damien George2017-01-19
| | | | | The if-block that this unreachable code is in has a condition "f>=5" so "fp_isless1(f)" will always fail.
* py/formatfloat: Fix further cases of buffer overflow in formatting.Damien George2016-03-29
| | | | | Includes extensive test cases to catch hopefully all cases where buffer might overflow.
* py/formatfloat: Fix case of float format where leading digit was "10".Damien George2016-03-29
| | | | | | | | | | When taking the logarithm of the float to determine the exponent, there are some edge cases that finish the log loop too large. Eg for an input value of 1e32-epsilon, this is actually less than 1e32 from the log-loop table and finishes as 10.0e31 when it should be 1.0e32. It is thus rendered as :e32 (: comes after 9 in ascii). There was the same problem with numbers less than 1.
* py/formatfloat: Fix buffer overflow when formatting tiny numbers.Damien George2016-03-15
|
* py/formatfloat: Add ability to format doubles with exponents > 99.Damien George2016-01-29
| | | | | | | | For single prec, exponents never get larger than about 37. For double prec, exponents can be larger than 99 and need 3 bytes to format. This patch makes the number of bytes needed configurable. Addresses issue #1772.
* py/formatfloat: Handle calculation of integer digit for %f format properly.Paul Sokolovsky2015-11-22
| | | | | %f prints true integer digit, so its calculation should happen before any exponential scaling.
* py/formatfloat: Workaround (fix?) incorrect rounding for %f format.Paul Sokolovsky2015-11-22
|
* py/formatfloat: Convert to fully portable implementation.Paul Sokolovsky2015-11-22
| | | | | | | | | | | This takes previous IEEE-754 single precision float implementation, and converts it to fully portable parametrizable implementation using C99 functions like signbit(), isnan(), isinf(). As long as those functions are available (they can be defined in adhoc manner of course), and compiler can perform standard arithmetic and comparison operations on a float type, this implementation will work with any underlying float type (including types whose mantissa is larger than available intergral integer type).
* stmhal: fix single precision float printing errorDave Hylands2015-09-11
| | | | Fixes #1435.
* py: Implement mp_format_float for doubles and use where appropriatestijn2015-05-17
| | | | | | | This allows using (almost) the same code for printing floats everywhere, removes the dependency on sprintf and uses just snprintf and applies an msvc-specific fix for snprintf in a single place so nan/inf are now printed correctly.
* py/formatfloat.c: Fix format of floating point numbers near 1.0.Dave Hylands2015-04-12
| | | | | | | | | | | In particular, numbers which are less than 1.0 but which round up to 1.0. This also makes those numbers which round up to 1.0 to print with e+00 rather than e-00 for those formats which print exponents. Addresses issue #1178.
* py: Move to guarded includes, everywhere in py/ core.Damien George2015-01-01
| | | | Addresses issue #1022.
* formatfloat.c: Typo fix in comment.Paul Sokolovsky2014-07-17
|
* Add license header to (almost) all files.Damien George2014-05-03
| | | | | | | Blanket wide to all .c and .h files. Some files originating from ST are difficult to deal with (license wise) so it was left out of those. Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
* Enhance str.format supportDave Hylands2014-04-01
| | | | | | | | | | | This adds support for almost everything (the comma isn't currently supported). The "unspecified" type with floats also doesn't behave exactly like python. Tested under unix with float and double Spot tested on stmhal
* py: Clean up includes.xbe2014-03-17
| | | | Remove unnecessary includes. Add includes that improve portability.
* Rename formatfloat file; remove MICROPY_ENABLE_FLOAT from mpconfigport.h.Damien George2014-03-10
MICROPY_ENABLE_FLOAT is automatically set in mpconfig.h if MICROPY_FLOAT_IMPL is set to a non-zero value.