Chebyshev
Unit testing for scientific software
Loading...
Searching...
No Matches
interval.h
Go to the documentation of this file.
1
5
6#ifndef CHEBYSHEV_INTERVAL_H
7#define CHEBYSHEV_INTERVAL_H
8
9
10namespace chebyshev {
11
12 namespace prec {
13
16 struct interval {
17
19 double a;
20
22 double b;
23
25 interval() : a(0), b(0) {}
26
27
30
31
33 inline real_t length() const {
34 const real_t diff = b - a;
35 return diff > 0 ? diff : -diff;
36 }
37 };
38
39 }
40}
41
42
43#endif
double real_t
Floating-point type, used as default for function arguments.
Definition common.h:37
General namespace of the framework.
Definition benchmark.h:22
constexpr FloatType get_nan()
Get a quiet NaN of the specified floating point type.
Definition common.h:65
An interval on the real numbers.
Definition interval.h:16
real_t length() const
Returns the length of the interval.
Definition interval.h:33
double a
Lower extreme of the interval.
Definition interval.h:19
interval(real_t l, real_t r)
Construct an interval from its lower and upper bounds.
Definition interval.h:29
double b
Upper extreme of the interval.
Definition interval.h:22
interval()
Construct over the origin.
Definition interval.h:25