Skip to content

Replace C style M_PI constant to C++20 std::numbers::pi in a few years #2

@innovation-plantation

Description

@innovation-plantation

C++ standard finally defined pi. Compilers should catch up within a few years.

Once this feature becomes common (when the g++ compiler for the top distro on distrowatch defaults to support it),
insert the code:

#include <numbers>
using std::numbers::pi;

and rename M_PI to pi throughout Turtle.cpp

Until then, if your compiler no longer provides the old M_PI definition, you can define it on the compiler command line.

e.g. change g++ to g++ -DM_PI=3.14159 wherever g++ is called to compile the program.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions