Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
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
17namespace model
18{
19
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:
33
34 BestRationalApproximation(const double &f, const LongIntType &md);
35 };
36
37} // namespace model
38#endif
BestRationalApproximation(const double &f, const LongIntType &md)
function int_R syms a b c u real f
Definition int_R.m:4