From a896951a9a8d8585d094e5ee6d7d37ff17d1b73e Mon Sep 17 00:00:00 2001 From: Colin Hogben Date: Mon, 9 May 2016 22:11:34 +0100 Subject: py/objfloat, py/modmath: Ensure M_PI and M_E defined. In some compliation enviroments (e.g. mbed online compiler) with strict standards compliance, does not define constants such as M_PI. Provide fallback definitions of M_E and M_PI where needed. --- py/modmath.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'py/modmath.c') diff --git a/py/modmath.c b/py/modmath.c index 6abf8ab3e9..54262f6115 100644 --- a/py/modmath.c +++ b/py/modmath.c @@ -31,6 +31,11 @@ #include +// M_PI is not part of the math.h standard and may not be defined +#ifndef M_PI +#define M_PI (3.14159265358979323846) +#endif + /// \module math - mathematical functions /// /// The `math` module provides some basic mathematical funtions for -- cgit v1.2.3