Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: mathematical operators

by BazB (Priest)
on Jun 16, 2003 at 21:59 UTC ( [id://266311]=note: print w/replies, xml ) Need Help??


in reply to mathematical operator for integer division, "div" ?

Not math, but perl -le 'print sprintf("%.0f", 5/3);'.

Try perldoc -q round for a more complete answer.

Update: monsieur_champs++ might well be right, but the AnonyMonk's question is unclear. 5/3 rounded to the nearest integer is 2, but so is 5 % 3 :-)


If the information in this post is inaccurate, or just plain wrong, don't just downvote - please post explaining what's wrong.
That way everyone learns.

Replies are listed 'Best First'.
Re: Re: mathematical operators
by monsieur_champs (Curate) on Jun 17, 2003 at 14:34 UTC

    Dear BazB

    Our anonymous fellow was asking about the remainder operator (%). What I see here is a (useful, indeed) number formatting tip. Please correct this one. ++BazB for his sincere and humble signature asking for other monks to teach him.

    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    Just Another Perl Monk

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-26 05:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found