This repository was archived by the owner on Apr 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintervalarithmetic.h
More file actions
77 lines (68 loc) · 2.04 KB
/
intervalarithmetic.h
File metadata and controls
77 lines (68 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
* IntervalArithmetic.h
*
* Created on: 20-11-2012
* Author: Tomasz Hoffmann and Andrzej Marciniak
*
* Before you start use module, please install libraries:
* - .boost ( http://www.boost.org/ )
* - GNU MPFR ( http://www.mpfr.org/ )
*/
#ifndef INTERVALARITHMETIC_H_
#define INTERVALARITHMETIC_H_
#include <iostream>
#include <string>
#include <sstream>
#include <exception>
#include <fenv.h>
#include <stdlib.h>
#include <stdint.h>
#include <mpfr.h>
#include <boost/lexical_cast.hpp>
#include <gmp.h>
using namespace std;
/*
* */
namespace intervalarth
{
struct interval
{
long double a, b;
};
//set precision
const int curr_precision = 80;
// store the original rounding mode
const int originalRounding = fegetround();
const char DecimalSeparator = '.';
class IntervalArithmetic
{
public:
IntervalArithmetic();
virtual ~IntervalArithmetic();
long double IntWidth(const interval& x);
interval IAdd(const interval& x, const interval& y);
interval ISub(const interval& x, const interval& y);
interval IMul(const interval& x, const interval& y);
interval IDiv(const interval& x, const interval& y);
long double DIntWidth(const interval& x);
interval Projection(const interval& x);
interval Opposite(const interval& x);
interval Inverse(const interval& x);
interval DIAdd(const interval& x, const interval& y);
interval DISub(const interval& x, const interval& y);
interval DIMul(const interval& x, const interval& y);
interval DIDiv(const interval& x, const interval& y);
interval IntRead(const string& sa);
long double LeftRead(const string& sa);
long double RightRead(const string& sa);
interval ISin(const interval& x, int& st);
interval ICos(const interval& x, int& st);
interval IExp(const interval& x, int& st);
interval ISqr(const interval& x, int& st);
interval ISqr2();
interval ISqr3();
interval IPi();
void IEndsToStrings(const interval& i, string& left, string& right);
};
} /* namespace interval */
#endif /* INTERVALARITHMETIC_H_ */