CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [Demerzel] modulo in PERl vs PHP: Edit Log



FishMonger
Veteran / Moderator

Dec 20, 2012, 7:55 AM


Views: 2033
Re: [Demerzel] modulo in PERl vs PHP

The simple answer is that the bcmod() function does not use the exact same method to calculate the modulus as Perl's modulus operator.

I have not looked at the related C source code of either language, but obviously they need to preform division which returns a floating point number which then is either truncated or rounded to an integer. If it is rounded, is it being rounded up or down (POSIX ceil or floor)?

Why are you stringifying the numbers and unnecessarily using concatenation? PHP might need to use that inefficiency, but Perl doesn't.


(This post was edited by FishMonger on Dec 20, 2012, 7:59 AM)


Edit Log:
Post edited by FishMonger (Veteran) on Dec 20, 2012, 7:56 AM
Post edited by FishMonger (Veteran) on Dec 20, 2012, 7:59 AM
Post edited by FishMonger (Veteran) on Dec 20, 2012, 7:59 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives