carl  24.04
Computer ARithmetic Library
NumberOperations.h
Go to the documentation of this file.
1 #pragma once
2 
7 
8 namespace carl {
9 
10 /* operations for rationals */
11 
12 template<typename Number, typename = std::enable_if_t<is_number_type<Number>::value>>
13 const Number& branching_point(const Number& n) {
14  return n;
15 }
16 
17 template<typename Number, typename = std::enable_if_t<is_number_type<Number>::value>>
18 Number sample_above(const Number& n) {
19  return carl::floor(n) + 1;
20 }
21 template<typename Number, typename = std::enable_if_t<is_number_type<Number>::value>>
22 Number sample_below(const Number& n) {
23  return carl::ceil(n) - 1;
24 }
25 template<typename Number, typename = std::enable_if_t<is_number_type<Number>::value>>
26 Number sample_between(const Number& lower, const Number& upper) {
27  return sample(Interval<Number>(lower, upper), false);
28 }
29 
30 }
carl is the main namespace for the library.
Interval< Number > ceil(const Interval< Number > &_in)
Method which returns the next larger integer of the passed number or the number itself,...
Definition: Interval.h:1535
Number sample(const Interval< Number > &i, bool includingBounds=true)
Searches for some point in this interval, preferably near the midpoint and with a small representatio...
Definition: Sampling.h:30
Interval< Number > floor(const Interval< Number > &_in)
Method which returns the next smaller integer of this number or the number itself,...
Definition: Interval.h:1523
const Number & branching_point(const Number &n)
Number sample_above(const Number &n)
Number sample_below(const Number &n)
Number sample_between(const Number &lower, const Number &upper)
The class which contains the interval arithmetic including trigonometric functions.
Definition: Interval.h:134