Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Modulo operation to return quotient and remainder

by moritz (Cardinal)
on Jul 12, 2012 at 11:54 UTC ( #981384=note: print w/ replies, xml ) Need Help??

in reply to Modulo operation to return quotient and remainder

While many modern CPU instruction sets support getting quotient and remainder in a single operation, nearly no high-level programming languages support it. Not even C (unless via embedded assembler).

In Perl, the overhead of a single subroutine call is probably much bigger than simply performing two separate operations, so from a performance point of view, you shouldn't bother.

If you are after convenience, it's easy enough to write a subroutine yourself that does it.

Comment on Re: Modulo operation to return quotient and remainder

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://981384]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2015-11-26 20:46 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (707 votes), past polls