C..4 円周率はどう計算する

Constang::PiREAL 型、つまり double で あって、INTERVAL ではない。

test3.cpp

// test3.cpp
// g++ -I/usr/local/include/profil -o test3 test3.cpp -lProfil -lBias -llr
//

#include <iostream>
#include <iomanip>
#include <Functions.h>
#include <Interval.h>
using namespace std;

int main(void)
{
  cout << setprecision(18);
  cout << Constant::Pi << endl;
  cout << 4 * ArcTan(1) << endl;
  cout << Hull(4) * ArcTan(1) << endl;
  cout << 4 * ArcTan(Hull(1)) << endl;
  cout << 4 * ArcTan(INTERVAL(1)) << endl;
  cout << 4 * ArcTan((INTERVAL)1) << endl;
  cout << "幅=" << Diam(4*ArcTan(Hull(1))) << endl;
  INTERVAL MyPI(Pred(Constant::Pi), Succ(Constant::Pi));
  cout << MyPI << endl;  
  cout << "幅=" << Diam(MyPI) << endl;
  return 0;
}
test3 の結果

[katsurada-no-MacBook-Air-4:~/work/tmp] mk% ./test3
3.14159265358979312
3.14159265358979312
3.141592653589793[1,2]
3.14159265358979[22,58]
3.14159265358979[22,58]
3.14159265358979[22,58]
幅=3.55271367880050093e-15
3.14159265358979[26,36]
幅=8.88178419700125233e-16
[katsurada-no-MacBook-Air-4:~/work/tmp] mk%

桂田 祐史
2020-09-03