note 95362 added to ref.bc

From: Date: Tue, 29 Dec 2009 10:24:09 +0000
Subject: note 95362 added to ref.bc
Groups: php.notes 
Request: Send a blank email to php-notes+get-164420@lists.php.net to get a copy of this message
In reference to the factorial function posted previously: A recursive solution is almost any time worse than an iterative one. Plus, in this case it is easy to provide such a solution: <?php bcfact($x) { $res = 1; for ($i = $x; bccomp($i, '0') == 1; bcsub($i, '1')) { $res = bcmul($res, $i); } return $res; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 79.215.139.91 ---- Manual Page -- http://www.php.net/manual/en/ref.bc.php Edit -- https://master.php.net/note/edit/95362 Del: integrated -- https://master.php.net/note/delete/95362/integrated Del: useless -- https://master.php.net/note/delete/95362/useless Del: bad code -- https://master.php.net/note/delete/95362/bad+code Del: spam -- https://master.php.net/note/delete/95362/spam Del: non-english -- https://master.php.net/note/delete/95362/non-english Del: in docs -- https://master.php.net/note/delete/95362/in+docs Del: other reasons-- https://master.php.net/note/delete/95362 Reject -- https://master.php.net/note/reject/95362 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164420) next »