summaryrefslogtreecommitdiffstatshomepage
path: root/py/objfloat.c
Commit message (Collapse)AuthorAge
* py: Add object repr "C", where 30-bit floats are stuffed in obj word.Damien George2015-10-20
| | | | | | This new object representation puts floats into the object word instead of on the heap, at the expense of reducing their precision to 30 bits. It only makes sense when the word size is 32-bits.
* py: Make float representation configurable with object representation.Damien George2015-10-20
|
* py: Move float e/pi consts to objfloat and make mp_obj_float_t private.Damien George2015-10-20
|
* py: Add mp_obj_is_float function (macro) and use it where appropriate.Damien George2015-10-20
|
* py: Rename MP_BOOL() to mp_obj_new_bool() for consistency in naming.Paul Sokolovsky2015-10-11
|
* py: Add MP_BINARY_OP_DIVMOD to simplify and consolidate divmod builtin.Damien George2015-06-13
|
* 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: Fix printing of "inf" and "nan" floating point values.Damien George2015-04-22
|
* py: Overhaul and simplify printf/pfenv mechanism.Damien George2015-04-16
| | | | | | | | | | | | | | | | | | | | | | Previous to this patch the printing mechanism was a bit of a tangled mess. This patch attempts to consolidate printing into one interface. All (non-debug) printing now uses the mp_print* family of functions, mainly mp_printf. All these functions take an mp_print_t structure as their first argument, and this structure defines the printing backend through the "print_strn" function of said structure. Printing from the uPy core can reach the platform-defined print code via two paths: either through mp_sys_stdout_obj (defined pert port) in conjunction with mp_stream_write; or through the mp_plat_print structure which uses the MP_PLAT_PRINT_STRN macro to define how string are printed on the platform. The former is only used when MICROPY_PY_IO is defined. With this new scheme printing is generally more efficient (less layers to go through, less arguments to pass), and, given an mp_print_t* structure, one can call mp_print_str for efficiency instead of mp_printf("%s", ...). Code size is also reduced by around 200 bytes on Thumb2 archs.
* py, extmod: Remove include of unnecessary system headers.Damien George2015-03-14
|
* py: Parse big-int/float/imag constants directly in parser.Damien George2015-02-08
| | | | | | | | | Previous to this patch, a big-int, float or imag constant was interned (made into a qstr) and then parsed at runtime to create an object each time it was needed. This is wasteful in RAM and not efficient. Now, these constants are parsed straight away in the parser and turned into objects. This allows constants with large numbers of digits (so addresses issue #1103) and takes us a step closer to #722.
* py, unix: Allow to compile with -Wunused-parameter.Damien George2015-01-20
| | | | See issue #699.
* py: Move to guarded includes, everywhere in py/ core.Damien George2015-01-01
| | | | Addresses issue #1022.
* py: Implement divmod, % and proper // for floating point.Damien George2014-09-13
| | | | Tested and working on unix and pyboard.
* py and libm: Add asinf,acosf; print higher precision for float.Damien George2014-09-11
| | | | | | Also use less stack space when printing single precision float. Addition of asinf and acosf addresses issue #851.
* py: Change all uint to mp_uint_t in obj.h.Damien George2014-08-30
| | | | Part of code cleanup, working towards resolving issue #50.
* Change some parts of the core API to use mp_uint_t instead of uint/int.Damien George2014-08-30
| | | | Addressing issue #50, still some way to go yet.
* py: Separate MICROPY_PY_BUILTINS_COMPLEX from MICROPY_PY_BUILTINS_FLOAT.Paul Sokolovsky2014-06-20
| | | | | One thing is wanting to do 1 / 2 and get something else but 0, and quite another - doing rocket science ;-).
* Rename bultins config variables to MICROPY_PY_BUILTINS_*.Damien George2014-06-01
| | | | | | | | | | This renames: MICROPY_PY_FROZENSET -> MICROPY_PY_BUILTINS_FROZENSET MICROPY_PY_PROPERTY -> MICROPY_PY_BUILTINS_PROPERTY MICROPY_PY_SLICE -> MICROPY_PY_BUILTINS_SLICE MICROPY_ENABLE_FLOAT -> MICROPY_PY_BUILTINS_FLOAT See issue #35 for discussion.
* py: Rename MP_OBJ_NOT_SUPPORTED to MP_OBJ_NULL.Damien George2014-05-21
| | | | See issue #608 for justification.
* py: Use mp_arg_check_num in more places.Damien George2014-05-11
| | | | | | | | | Updated functions now do proper checking that n_kw==0, and are simpler because they don't have to explicitly raise an exception. Down side is that the error messages no longer include the function name, but that's acceptable. Saves order 300 text bytes on x64 and ARM.
* py: Tidy up returning NULL which should be MP_OBJ_NOT_SUPPORTED.Damien George2014-05-10
|
* 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/.
* py, unix: Make "mpconfig.h" be first included, as other headers depend on it.Paul Sokolovsky2014-05-02
| | | | Specifically, nlr.h does.
* objfloat: Try to achieve the same float printing format as CPython does.Paul Sokolovsky2014-04-18
| | | | | | | Test usecase I used is print(time.time()) and print(time.time() - time.time()). On Linux/Glibc they now give the same output as CPython 3.3. Specifically, time.time() gives non-exponential output with 7 decimal digits, and subtraction gives exponential output e-06/e-07.
* py: Add MP_OBJ_STOP_ITERATION and make good use of it.Damien George2014-04-17
| | | | | Also make consistent use of MP_OBJ_NOT_SUPPORTED and MP_OBJ_NULL. This helps a lot in debugging and understanding of function API.
* py: Detect ZeroDivisionError properly for floats.Damien George2014-04-13
|
* py: Implement float and complex == and !=.Damien George2014-04-11
| | | | Addresses issue #462.
* py: Fix float/complex binop returning NULL; implement complex power.Damien George2014-04-10
|
* py: Fix float printing on stmhal.Damien George2014-04-05
|
* py: Change nlr_jump to nlr_raise, to aid in debugging.Damien George2014-04-05
| | | | | | This does not affect code size or performance when debugging turned off. To address issue #420.
* py: Implement floating point power binop.Damien George2014-04-02
|
* objfloat: Quick&dirty implementation of float floor division.Paul Sokolovsky2014-03-31
| | | | TODO: Likely doesn't match Python semantics for negative numbers.
* objfloat: Make sure that floats always have dot (for C "double" type case).Paul Sokolovsky2014-03-31
| | | | | This matches CPython behavior and hopefully can be treated as general Python semantics.
* objfloat: Missing default: caused incorrect results for unimplemented ops.Paul Sokolovsky2014-03-31
|
* Rename rt_* to mp_*.Damien George2014-03-30
| | | | | | | Mostly just a global search and replace. Except rt_is_true which becomes mp_obj_is_true. Still would like to tidy up some of the names, but this will do for now.
* Merge remote-tracking branch 'upstream/master'Rachel Dowdall2014-03-22
|\
| * py: Allow 'complex()' to take a string as first argument.Damien George2014-03-21
| |
| * py: Implement parsing of infinity and nan for floats.Damien George2014-03-21
| |
* | Added ZeroDivisionError to float division.Rachel Dowdall2014-03-20
|/
* py: Clean up includes.xbe2014-03-17
| | | | Remove unnecessary includes. Add includes that improve portability.
* py: Implement integer overflow checking for * and << ops.Damien George2014-03-12
| | | | If operation will overflow, a multi-precision integer is created.
* 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.
* Add proper floating point printing support.Dave Hylands2014-03-10
|
* Implement ROMable modules. Add math module.Damien George2014-03-08
| | | | | | | | | | mp_module_obj_t can now be put in ROM. Configuration of float type is now similar to longint: can now choose none, float or double as the implementation. math module has basic math functions. For STM port, these are not yet implemented (they are just stub functions).
* py: Put number parsing code together in parsenum.c.Damien George2014-02-22
|
* Implement proper exception type hierarchy.Damien George2014-02-15
| | | | | | | | | | | | | | Each built-in exception is now a type, with base type BaseException. C exceptions are created by passing a pointer to the exception type to make an instance of. When raising an exception from the VM, an instance is created automatically if an exception type is raised (as opposed to an exception instance). Exception matching (RT_BINARY_OP_EXCEPTION_MATCH) is now proper. Handling of parse error changed to match new exceptions. mp_const_type renamed to mp_type_type for consistency.
* Change mp_obj_type_t.name from const char * to qstr.Damien George2014-02-15
| | | | | | Ultimately all static strings should be qstr. This entry in the type structure is only used for printing error messages (to tell the type of the bad argument), and printing objects that don't supply a .print method.
* Remove mp_obj_new_exception_msg_1_arg and _2_arg.Damien George2014-02-12
|
* Replace global "static" -> "STATIC", to allow "analysis builds". Part 1.Paul Sokolovsky2014-02-12
| | | | | | | | Some tools do not support local/static symbols (one example is GNU ld map file). Exposing all functions will allow to do detailed size comparisons, etc. Also, added bunch of statics where they were missing, and replaced few identity functions with global mp_identity().