File tree 1 file changed +9
-8
lines changed
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -123,9 +123,10 @@ void te_free(te_expr *n) {
123
123
}
124
124
125
125
126
- static double pi () {return 3.14159265358979323846 ;}
127
- static double e () {return 2.71828182845904523536 ;}
128
- static double fac (double a) {/* simplest version of fac */
126
+ static constexpr double pi () { return M_PI; }
127
+ static constexpr double e () { return M_E; }
128
+
129
+ static double fac (double a) { /* simplest version of fac */
129
130
if (a < 0.0 )
130
131
return NAN;
131
132
if (a > UINT_MAX)
@@ -198,11 +199,11 @@ static const te_builtin *find_builtin(const char *name, int len) {
198
199
return NULL ;
199
200
}
200
201
201
- static double add (double a, double b) {return a + b;}
202
- static double sub (double a, double b) {return a - b;}
203
- static double mul (double a, double b) {return a * b;}
204
- static double divide (double a, double b) {return a / b;}
205
- static double negate (double a) {return -a;}
202
+ static constexpr double add (double a, double b) {return a + b;}
203
+ static constexpr double sub (double a, double b) {return a - b;}
204
+ static constexpr double mul (double a, double b) {return a * b;}
205
+ static constexpr double divide (double a, double b) {return a / b;}
206
+ static constexpr double negate (double a) {return -a;}
206
207
207
208
void next_token (state *s) {
208
209
s->type = TOK_NULL;
You can’t perform that action at this time.
0 commit comments