Skip to content
Snippets Groups Projects
  1. Sep 26, 2018
    • Christopher Swenson's avatar
      py/modmath: Add math.factorial, optimised and non-opt implementations. · 8c656754
      Christopher Swenson authored
      This commit adds the math.factorial function in two variants:
      - squared difference, which is faster than the naive version, relatively
        compact, and non-recursive;
      - a mildly optimised recursive version, faster than the above one.
      
      There are some more optimisations that could be done, but they tend to take
      more code, and more storage space.  The recursive version seems like a
      sensible compromise.
      
      The new function is disabled by default, and uses the non-optimised version
      by default if it is enabled.  The options are MICROPY_PY_MATH_FACTORIAL
      and MICROPY_OPT_MATH_FACTORIAL.
      8c656754
  2. Sep 20, 2018
  3. Oct 10, 2017
    • Damien George's avatar
      py/modmath: Convert log2 macro into a function. · d8d4e4df
      Damien George authored
      So that a pointer to it can be passed as a pointer to math_generic_1.  This
      patch also makes the function work for single and double precision floating
      point.
      d8d4e4df
    • Damien George's avatar
      py/modmath: Add full checks for math domain errors. · 25e14065
      Damien George authored
      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.
      25e14065
  4. Aug 30, 2017
  5. Jul 31, 2017
  6. Jul 03, 2017
  7. Jun 15, 2017
  8. Mar 23, 2017
  9. Nov 03, 2016
  10. Sep 21, 2016
  11. May 12, 2016
  12. Jan 11, 2016
  13. Dec 12, 2015
  14. Nov 29, 2015
  15. Nov 17, 2015
  16. Nov 13, 2015
  17. Oct 20, 2015
  18. Oct 11, 2015
  19. Jun 13, 2015
  20. Feb 22, 2015
  21. Jan 01, 2015
  22. Dec 10, 2014
  23. Nov 29, 2014
  24. Aug 10, 2014
  25. Jul 03, 2014
  26. Jun 21, 2014
  27. Jun 19, 2014
  28. Jun 01, 2014
    • Damien George's avatar
      Rename bultins config variables to MICROPY_PY_BUILTINS_*. · fb510b3b
      Damien George authored
      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.
      fb510b3b
  29. May 24, 2014
  30. May 12, 2014
  31. May 03, 2014
    • Damien George's avatar
      Add license header to (almost) all files. · 04b9147e
      Damien George authored
      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/.
      04b9147e
  32. Apr 26, 2014
  33. Apr 17, 2014
  34. Apr 05, 2014
  35. Apr 01, 2014
  36. Mar 30, 2014
    • Damien George's avatar
      Merge map.h into obj.h. · df6567e6
      Damien George authored
      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.
      df6567e6
  37. Mar 25, 2014
Loading