Re: bcmath, standart ?

From: Date: Thu, 13 Jun 2002 16:24:17 +0000
Subject: Re: bcmath, standart ?
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-6991@lists.php.net to get a copy of this message
You might want to consider using a fallback method: If the bcmath module is loaded use bcmod() otherwise check if the fmod() function is defined (added to php4/ext/math.c back in February IIRC) and use that one, or if that functions is not defined fall back to a simple implementation like: function modf($a, $b) { $r = $a / $b; $i = intval($r); return ($r - $i) * $b; } (from some old code for numPHP I got lying around) As far as GMP, for what I see in the PHP source only the integer functions have been wrapped, not the floating point ones. --- Pierre-Alain Joye <paj@pearfr.org> wrote: > Hello, > > > Currently need the modulo operator, the problem is % is limited to int in php > (direct uses of the c operator after conversion to long), and is not enough > for my needs (IBAN, BAN,... for Validate). > > Should I consider the bcmath ( or gmp) as a widely used module ? Or have I to > use a php implementation of modulo ? note that works with a larger ranger, > division in php can work with double as well as long. And it s funny to see a > php function works and the native operator failed, normal but funny ;). > > pa > > > > -- > PEAR Development Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ===== --- Jesus M. Castagnetto (jcastagnetto@yahoo.com) Research: http://metallo.scripps.edu/ Personal: http://www.castagnetto.org/ __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com

« previous php.pear.dev (#6991) next »