From 814e2dee066a3e6b250e96904c7b12d79f6f9276 Mon Sep 17 00:00:00 2001 From: Yaya-Cout <67095734+Yaya-Cout@users.noreply.github.com> Date: Wed, 2 Feb 2022 22:18:04 +0100 Subject: [PATCH] [python] Enable math.factorial (#141) --- python/port/genhdr/qstrdefs.in.h | 1 + python/port/mpconfigport.h | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/python/port/genhdr/qstrdefs.in.h b/python/port/genhdr/qstrdefs.in.h index 322b23c0c..53c2f0b85 100644 --- a/python/port/genhdr/qstrdefs.in.h +++ b/python/port/genhdr/qstrdefs.in.h @@ -181,6 +181,7 @@ Q(exp) Q(expm1) Q(extend) Q(fabs) +Q(factorial) Q(filter) Q(find) Q(float) diff --git a/python/port/mpconfigport.h b/python/port/mpconfigport.h index 38e98145a..9175793b2 100644 --- a/python/port/mpconfigport.h +++ b/python/port/mpconfigport.h @@ -82,6 +82,12 @@ // Whether to provide special math functions: math.{erf,erfc,gamma,lgamma} #define MICROPY_PY_MATH_SPECIAL_FUNCTIONS (1) +// Whether to provide math.factorial function +#define MICROPY_PY_MATH_FACTORIAL (1) + +// Whether math.factorial is large, fast and recursive (1) or small and slow (0). +#define MICROPY_OPT_MATH_FACTORIAL (0) + // Whether to provide "cmath" module #define MICROPY_PY_CMATH (1)