konoha-project/minikonoha — pull request #190 by tetsurom (2012-10-15 22:56:43+00:00)
Title: add Mpf class to gmp package

Mpf is now available!!

```
import("konoha")
import("konoha.math")
import("gmp")

void main(){
Mpf epsilon = new Mpf("1.0e-10");
Mpf c = Math.sqrt(0.125);
Mpf a = 1 + 3 * c;
Mpf b = a.sqrt();
Mpf e = b - 0.625;
b = 2 * b;
c = e - c;
a = a + e;
Mpf npow = 4;
while (e > epsilon){
npow = 2 * npow;
e = (a + b) * 0.5;
b = (a * b).sqrt();
e = e - b;
b = 2 * b;
c = c - e;
a = e + b;
}
e = e * e / 4;
a = a + b;
Mpf pi = (a * a - e - e / 2) / (a * c - e) / npow;
System.p(pi);
}

main(); // 3.14159263514900797503
```