Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: A better mod (%) operator?

by fglock (Vicar)
on Jul 10, 2002 at 19:01 UTC ( #180837=note: print w/replies, xml ) Need Help??


in reply to A better mod (%) operator?

This is something I used in the old times when multiplication was much faster than division:

sub divmod { use integer; my ($a, $b) = @_; my $tmp = $a / $b; ($tmp, $a - ($b * $tmp) ); } $a = 13; $b = 2; print divmod($a, $b);

This is much more interesting to do in assembler then in Perl (maybe Parrot?)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2020-11-25 01:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?