Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
include
Math
BestRationalApproximation.h
Go to the documentation of this file.
1
/* This file is part of MoDELib, the Mechanics Of Defects Evolution Library.
2
*
3
*
4
* MoDELib is distributed without any warranty under the
5
* GNU General Public License (GPL) v2 <http://www.gnu.org/licenses/>.
6
*/
7
8
#ifndef model_BESTRATIONALAPPROXIMATION_H_
9
#define model_BESTRATIONALAPPROXIMATION_H_
10
11
12
// https://rosettacode.org/wiki/Convert_decimal_number_to_rational#C
13
14
#include <cstdint>
15
#include <utility>
16
17
namespace
model
18
{
19
20
class
BestRationalApproximation
21
{
22
public
:
23
typedef
int64_t
LongIntType
;
24
25
private
:
26
static
std::pair<LongIntType, LongIntType> rat_approx(
double
f
,
LongIntType
md);
27
28
const
std::pair<LongIntType, LongIntType> intPair;
29
30
public
:
31
const
LongIntType
&
num
;
32
const
LongIntType
&
den
;
33
34
BestRationalApproximation
(
const
double
&
f
,
const
LongIntType
&md);
35
};
36
37
}
// namespace model
38
#endif
model::BestRationalApproximation::den
const LongIntType & den
Definition
BestRationalApproximation.h:32
model::BestRationalApproximation::LongIntType
int64_t LongIntType
Definition
BestRationalApproximation.h:23
model::BestRationalApproximation::num
const LongIntType & num
Definition
BestRationalApproximation.h:31
model::BestRationalApproximation::BestRationalApproximation
BestRationalApproximation(const double &f, const LongIntType &md)
Definition
BestRationalApproximation.cpp:78
f
function int_R syms a b c u real f
Definition
int_R.m:4
model
Definition
DD_converter.dox:2
Generated by
1.15.0