だいら #8751(2009/03/30 03:59 GMT) [ PHP ] Rating0/0=0.00
普通に
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<?php function cube_root($num) { $a = $num; while(true) { $b = ($num/($a*$a) + $a*2) / 3; ++$i; $diff = abs($b - $a); if($diff < 1e-12)break; $a = $b; } return $b; } //test code $ret = cube_root(10); printf("%.16f\n%.16f\n", $ret, $ret*$ret*$ret); $ret = cube_root(100); printf("%.16f\n%.16f\n", $ret, $ret*$ret*$ret);
Rating0/0=0.00-0+
[ reply ]
だいら
#8751()
[
PHP
]
Rating0/0=0.00
普通に
Rating0/0=0.00-0+
[ reply ]