octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #61812] Math constants (e.g. M_PI) are not par


From: Rik
Subject: [Octave-bug-tracker] [bug #61812] Math constants (e.g. M_PI) are not part of C/C++ standard
Date: Thu, 13 Jan 2022 12:10:39 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36

Follow-up Comment #6, bug #61812 (project octave):

> `atan` is not `constexpr`. But we could make that a `const double` at
least.

I think it is.  I changed the code to use `constexpr` and it compiles
correctly.  I believe the compiler can calculate atan at compile time by using
the build system's libraries and then it inserts the correct value.

But, if you are going to handle it by using "#define" then we should define
_XOPEN_SOURCE in data.cc so that we can always rely on having M_PI and then we
can remove the #ifdef/#else construct entirely.

Using grep, it seems like M_PI is used more widely than just graphics.cc.  The
list is


corefcn/data.cc
corefcn/gl-render.cc
corefcn/graphics.cc
corefcn/quadcc.cc
util/oct-cmplx.h
numeric/lo-mappers.cc
numeric/lo-specfun.cc
numeric/oct-norm.cc
numeric/randpoisson.cc



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?61812>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]