Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.3

Request #16788 modulo
Submitted: 2009-11-14 05:54 UTC
From: stm Assigned:
Status: Open Package: Math_BigInteger (version 1.0.0RC3)
PHP Version: Irrelevant OS: linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 40 - 23 = ?

 
 [2009-11-14 05:54 UTC] stm (Martijn Bogaard)
Description: ------------ On this moment there is no implementation for a normal modulo. Could it be added please?

Comments

 [2009-11-15 21:09 UTC] terrafrost (Jim Wigginton)
To get modulos, currently, you'd need to do this: list(, $modulo) = $a->divide($b); The problem I have with creating a separate modulo function is that if you wanted both the quotient and the remainder you'd have to perform a divide operation twice, whereas right now, you only need to do it once. Now, I suppose I could make it so that the quotient and the modulo are stored in a class variable and then add something like this to the start of the divide() and mod() functions: if ($this->numerator->equals($a) && $this->denominator->equals($b)) { return $this->remainder; // or $this->quotient if this code is in divide() } Only problem with that is that breaks backwards compatibility. Breaking backwards compatibility isn't necessarily a problem, I suppose, but I am, none-the-less, hesitant to do it.
 [2014-03-12 02:52 UTC] lexxy_fox (Nathan Lex)
I'm also in with adding the modulus function. Currently I need to perform it several times without finding the quotient.