SpECTRE  2021.08.02
ContinuedFraction< T > Class Template Reference

Compute the continued fraction representation of a number. More...

#include <FractionUtilities.hpp>

Public Types

using value_type = typename value_type_helper< T >::type
 The decayed return type of T::numerator() for a fraction, int64_t for other types.
 

Public Member Functions

 ContinuedFraction (const T &value) noexcept
 
value_type operator* () const noexcept
 Obtain the current element in the expansion.
 
 operator bool () const noexcept
 Check if the expansion is incomplete. If T is a fraction type this will be true until the full exact representation of the fraction is produced. If T is a floating point type this will be true until the estimated numerical error is larger than the remaining error in the representation.
 
ContinuedFraction & operator++ () noexcept
 Advance to the next element in the expansion.
 

Detailed Description

template<class T>
class ContinuedFraction< T >

Compute the continued fraction representation of a number.

The template argument may be a fraction type or a floating point type. If the expansion is computed exactly then it will be the shorter of the expansions for the given value.