summaryrefslogtreecommitdiff
path: root/py/modmath.c
AgeCommit message (Collapse)Author
2017-07-31all: Use the name MicroPython consistently in commentsAlexander Steffen
There were several different spellings of MicroPython present in comments, when there should be only one.
2017-07-04py/modmath: Check for zero division in log with 2 args.Damien George
2017-06-15all: Make more use of mp_raise_{msg,TypeError,ValueError} helpers.Damien George
2017-03-23py/modmath: Allow trunc/ceil/floor to return a big int if necessary.Damien George
Previous to this patch, if the result of the trunc/ceil/floor functions overflowed a small int, or was inf or nan, then a garbage value was returned. With this patch the correct big-int is returned if necessary, and exceptions are raised for inf or nan.
2016-11-03py: Add MICROPY_FLOAT_CONST macro for defining float constants.Damien George
All float constants in the core should use this macro to prevent unnecessary creation of double-precision floats, which makes code less efficient.
2016-09-22all: Remove 'name' member from mp_obj_module_t struct.Damien George
One can instead lookup __name__ in the modules dict to get the value.
2016-05-12py/objfloat, py/modmath: Ensure M_PI and M_E defined.Colin Hogben
In some compliation enviroments (e.g. mbed online compiler) with strict standards compliance, <math.h> does not define constants such as M_PI. Provide fallback definitions of M_E and M_PI where needed.
2016-01-11py: Change type signature of builtin funs that take variable or kw args.Damien George
With this patch the n_args parameter is changed type from mp_uint_t to size_t.
2015-12-12py/modmath: Add domain error checking to sqrt, log, log2, log10.Michael Buesch
These functions will raise 'ValueError: math domain error' on invalid input.
2015-11-29py: Add MP_ROM_* macros and mp_rom_* types and use them.Damien George
2015-11-17py/modmath: Make log2, log10 and hyperbolic funcs be SPECIAL_FUNCTIONS.Damien George
Will be included only when MICROPY_PY_MATH_SPECIAL_FUNCTIONS is enabled. Also covers cmath module (but only log10 is there at the moment).
2015-11-14py/modmath: Don't create symbol entry for expm1() if not needed.Paul Sokolovsky
2015-11-14py/modmath: Make expm1() be in MICROPY_PY_MATH_SPECIAL_FUNCTIONS.Paul Sokolovsky
2015-11-13unix/mpconfigport: Move log2() definition to modmath.c.Paul Sokolovsky
It's safer to define it where it's used, defining it for all source files may lead to hard to diagnose conflicts in corner cases.
2015-10-20py: Move float e/pi consts to objfloat and make mp_obj_float_t private.Damien George
2015-10-11py: Rename MP_BOOL() to mp_obj_new_bool() for consistency in naming.Paul Sokolovsky
2015-06-13py: Implement second arg for math.log (optional value for base).Damien George
2015-02-22py: Make math special functions configurable and disabled by default.Damien George
The implementation of these functions is very large (order 4k) and they are rarely used, so we don't enable them by default. They are however enabled in stmhal and unix, since we have the room.
2015-01-01py: Move to guarded includes, everywhere in py/ core.Damien George
Addresses issue #1022.
2014-12-10py: Make functions static where appropriate.Damien George
2014-11-29Use MP_DEFINE_CONST_DICT macro to define module dicts.Damien George
This is just a clean-up of the code. Generated code is exactly the same.
2014-08-10doc: Document gc, sys, math, cmath.Damien George
2014-07-03Rename machine_(u)int_t to mp_(u)int_t.Damien George
See discussion in issue #50.
2014-06-21py: Include mpconfig.h before all other includes.Paul Sokolovsky
It defines types used by all other headers. Fixes #691.
2014-06-19Prefix ARRAY_SIZE with micropython prefix MP_Emmanuel Blot
2014-06-01Rename bultins config variables to MICROPY_PY_BUILTINS_*.Damien George
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.
2014-05-24Rename configuration variables controling Python features.Damien George
Now of the form MICROPY_PY_*. See issue #35.
2014-05-12Fix some unused variables, and silence a clang warning about initialization ↵Antonin ENFRUN
override in vmentrytable.h
2014-05-03Add license header to (almost) all files.Damien George
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/.
2014-04-26Add ARRAY_SIZE macro, and use it where possible.Damien George
2014-04-17py: Add cmath module, for complex math. Disabled by default.Damien George
Not all functions implemented. Not enabled on pyboard.
2014-04-05py: Change module globals from mp_map_t* to mp_obj_dict_t*.Damien George
Towards addressing issue #424. Had a small increase to ROM usage (order 60 bytes).
2014-04-01py: Fix math.{ceil,floor,trunc} to return int.Damien George
2014-03-30Merge map.h into obj.h.Damien George
Pretty much everyone needs to include map.h, since it's such an integral part of the Micro Python object implementation. Thus, the definitions are now in obj.h instead. map.h is removed.
2014-03-25Proper support for registering builtin modules in ROM.Damien George
Comes with some refactoring of code and renaming of files. All modules are now named mod*.[ch].