Pangolin
Header-only C++20 plane computational geometry library
Loading...
Searching...
No Matches
pgl::DivisionResult< Number > Struct Template Reference

Default result type for an operation that may require division. More...

#include <rational.hpp>

Public Types

using NumberType = std::remove_cvref_t<Number>
using type

Detailed Description

template<class Number>
struct pgl::DivisionResult< Number >

Default result type for an operation that may require division.

Floating-point coordinates retain their native type instead of being rationalized after they have already been approximated. Rational coordinates are already closed under division and likewise retain their native type. Integral coordinate types, including BigInt, use the overflow-free ERational type so fractional results remain exact.

Users may specialize this trait for custom coordinate types.

Member Typedef Documentation

◆ NumberType

template<class Number>
using pgl::DivisionResult< Number >::NumberType = std::remove_cvref_t<Number>

◆ type

template<class Number>
using pgl::DivisionResult< Number >::type
Initial value:
std::conditional_t<
std::floating_point<NumberType> || RationalConcept<NumberType>,
Definition rational.hpp:40
Rational< BigInt > ERational
Exact, overflow-free result used when integral coordinates require fractions.
Definition rational.hpp:1151
std::remove_cvref_t< Number > NumberType
Definition rational.hpp:1166