Skip to content

No need for global pi value. The <numbers> header exists in C++20. #67

Description

@cugone

The global pi declaration can be removed in favor of the mathematical constant declarations in the <numbers> header.

(It's only used in two places for now, so the change is minimal)

#include <numbers>
//...
// Get area of circle
inline constexpr T area() const
{
	return std::numbers::pi_v<T> * radius * radius;
}

// Get circumference of circle
inline constexpr T perimeter() const
{
	return T{2.0} * std::numbers::pi_v<T> * radius;
}
//...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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