carl
24.04
Computer ARithmetic Library
|
We define custom type traits for number types we use. More...
Modules | |
is_field_type | |
All types that represent a field are marked with is_field_type . | |
is_finite_type | |
All types that can represent only numbers from a finite domain are marked with is_finite_type . | |
is_float_type | |
All types that represent floating point numbers are marked with is_float_type . | |
is_integer_type | |
All integral types that can (in theory) represent all integers are marked with is_integer_type . | |
is_number_type | |
All types that represent any kind of number are marked with is_number_type . | |
is_rational_type | |
All integral types that can (in theory) represent all rationals are marked with is_rational_type . | |
IntegralType | |
The associated integral type of any type can be defined with IntegralType. | |
UnderlyingNumberType | |
The number type that some type is built upon can be defined with UnderlyingNumberType. | |
Files | |
file | typetraits.h |
file | typetraits.h |
file | typetraits.h |
file | typetraits.h |
We define custom type traits for number types we use.
We use the notation conventions of the STL, being lower cases with underscores.
We define the following type traits:
is_field_type
: Types that represent elements from a field.is_finite_type
: Types that represent only a finite domain.is_float_type
: Types that represent real numbers using a floating point representation.is_integer_type
: Types that represent the set of integral numbers.is_subset_of_integers_type
: Types that may represent some integral numbers.is_number_type
: Types that represent numbers.is_rational_type
: Types that may represent any rational number.is_subset_of_rationals_type
: Types that may represent some rational numbers.A more exact definition for each of these type traits can be found in their own documentation.
Additionally, we define related types in a type traits like manner:
IntegralType
: Integral type, that the given type is based on. For fractions, this would be the type of the numerator and denominator.UnderlyingNumberType
: Number type that is used within a more complex type. For polynomials, this would be the number type of the coefficients.Note that we keep away from similar type traits defined in the standard [4] (20.9) (like std::is_integral
or std::is_floating_point
, as they are not meant to be specialized for custom types.