[ create a new paste ] login | about

Link: http://codepad.org/eimN3SzZ    [ raw code | output | fork ]

PHP, pasted on Apr 10:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php

function f($x){
  return 20/pow(1+$x,14/365)+24/pow(1+$x,28/365)+1-40;
}

$min=-999999999;
$max=999999999;
while(abs($max-$min)>0.000001){
  $cur=($max+$min)/2;
  $rez=f($cur);
  if ($rez<0) $max=$cur; else $min=$cur;
}

echo $cur*100;


Output:
1
675.15619694078


Create a new paste based on this one


Comments: