Classes | |
class | BSUtilitiesError |
exception class, base for all exceptions in BSutilities More... | |
class | ConversionFailure |
exception class More... | |
class | Conversion |
convert between base types More... | |
class | NamedIFileStream |
class | NamedOFileStream |
class | RefCountedPointer |
struct | IF |
static metaprogramming if statement equivalent More... | |
struct | IF< false, Then, Else > |
struct | OR |
static metaprogramming OR More... | |
struct | OR< true, Arg2 > |
static metaprogramming OR More... | |
struct | OR< Arg1, true > |
static metaprogramming OR More... | |
struct | OR< true, true > |
static metaprogramming OR More... | |
class | EmptyTemplate_1 |
the EmptyTemplate with one class parameter More... | |
class | EmptyTemplate_2 |
the EmptyTemplate with two class parameters More... | |
struct | SameType |
check type equivalence, general case More... | |
struct | SameType< X, X > |
check type equivalence, specialization for both type equal More... | |
struct | SameTemplate_1 |
check equivalence of templates with one class parameter More... | |
struct | SameTemplate_1< X, X > |
check equivalence of templates with one class parameter, More... | |
struct | SameTemplate_2 |
check equivalence of templates with two class parameters More... | |
struct | SameTemplate_2< X, X > |
check equivalence of templates with two class parameters, More... | |
struct | Signum |
struct | Signum< 0L > |
struct | Abs |
struct | Gcd |
struct | Gcd< M, 0L > |
struct | Gcd< 0L, 0L > |
struct | Rational |
struct | Rational< 0L, D > |
specialization for N = 0 More... | |
class | RationalEquality< Rational< N1, D1 >, Rational< N2, D2 > > |
determine equality, specialization for two Rationals More... | |
class | RationalAdd< Rational< N1, D1 >, Rational< N2, D2 > > |
add two Rationals, specialization for two Rationals More... | |
class | RationalSub< Rational< N1, D1 >, Rational< N2, D2 > > |
subtract two Rationals, specialization for two Rationals More... | |
class | RationalMult< Rational< N1, D1 >, Rational< N2, D2 > > |
multiply two Rationals, specialization for two Rationals More... | |
class | RationalDiv< Rational< N1, D1 >, Rational< N2, D2 > > |
divide two Rationals, specialization for two Rationals More... | |
class | RationalNeg< Rational< N1, D1 > > |
negate Rational, specialization for Rational More... | |
struct | Concatenate< A, Loki::NullType > |
struct | Concatenate< Loki::NullType, B > |
struct | Concatenate< Loki::Typelist< Head1, Tail1 >, Loki::Typelist< Head2, Tail2 > > |
Namespaces | |
namespace | xmlr |
all entities for reading an XML file | |
namespace | xmlw |
Functions | |
std::string | version (void) |
the version of the BSUtilities classes | |
long | gcd (const long &i1, const long &i2) |
greatest common divisor, dynamic version | |
template<class T> | |
std::pair< long, long > | contFrac (const T &value) |
generate a rational's numerator and denominator from floating value |
std::pair<long, long> BSUtilities::contFrac | ( | const T & | value | ) | [inline] |
generate a rational's numerator and denominator from floating value
the floating point object value is represented by a rational number's numerator and denominator (both being integer values); the Continued Fraction algorithm, see e.g. J.M. Bucknall, http://www.boyet.com/Articles/GcdfractionClass.html or B.K.P. Horn, Rational Arithmetic for Minicomputers, Software - Practice and Experience 8, 171 - 176 (1978) (note typing error in Figure 3 of the Horn paper, must be (s - i)); algorithm ends if a) any one of the long ints exceeds or equals the largest long int, b) the difference between value and the representation is less than the epsilon of the source floating point type; returns a std::pair of long ints, the first element being the numerator, the second one being the denominator of the representing rational.
Definition at line 289 of file TemplateTools.h.
long BSUtilities::gcd | ( | const long & | i1, | |
const long & | i2 | |||
) | [inline] |
greatest common divisor, dynamic version
calculate the greatest common divisor of i1 and i2; designed along the above compile-time algorithm
Definition at line 262 of file TemplateTools.h.