File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -398,17 +398,17 @@ CompilerValue *CppCodeBuilder::createTan(CompilerValue *num)
398398
399399CompilerValue *CppCodeBuilder::createAsin (CompilerValue *num)
400400{
401- return mathFunction (num, " std::asin" , " * 180.0 / M_PI + 0.0" );
401+ return mathFunction (num, " std::asin" , " * 180.0 / cpp::PI + 0.0" );
402402}
403403
404404CompilerValue *CppCodeBuilder::createAcos (CompilerValue *num)
405405{
406- return mathFunction (num, " std::acos" , " * 180.0 / M_PI " );
406+ return mathFunction (num, " std::acos" , " * 180.0 / cpp::PI " );
407407}
408408
409409CompilerValue *CppCodeBuilder::createAtan (CompilerValue *num)
410410{
411- return mathFunction (num, " std::atan" , " * 180.0 / M_PI " );
411+ return mathFunction (num, " std::atan" , " * 180.0 / cpp::PI " );
412412}
413413
414414CompilerValue *CppCodeBuilder::createLn (CompilerValue *num)
Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ struct Frame
6363 int state = 0 ;
6464};
6565
66+ static constexpr double PI = 3.14159265358979323846 ;
67+
6668struct Str
6769{
6870 Str () :
@@ -231,12 +233,12 @@ inline double round(double x)
231233
232234inline double sin (double x)
233235{
234- return std::round (std::sin (x * M_PI / 180.0 ) * 1e10 ) / 1e10 + 0.0 ;
236+ return std::round (std::sin (x * PI / 180.0 ) * 1e10 ) / 1e10 + 0.0 ;
235237}
236238
237239inline double cos (double x)
238240{
239- return std::round (std::cos (x * M_PI / 180.0 ) * 1e10 ) / 1e10 ;
241+ return std::round (std::cos (x * PI / 180.0 ) * 1e10 ) / 1e10 ;
240242}
241243
242244inline double tan (double x)
@@ -248,7 +250,7 @@ inline double tan(double x)
248250 else if (m == -90.0 || m == 270.0 )
249251 return -std::numeric_limits<double >::infinity ();
250252
251- return std::round (std::tan (x * M_PI / 180.0 ) * 1e10 ) / 1e10 + 0.0 ;
253+ return std::round (std::tan (x * PI / 180.0 ) * 1e10 ) / 1e10 + 0.0 ;
252254}
253255
254256inline double random (ExecutionContext *ctx, double from, double to)
You can’t perform that action at this time.
0 commit comments