Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re: Rounding values upwards on an arbitrary basis

by Thelonius (Priest)
on Jul 02, 2003 at 21:03 UTC ( [id://270955]=note: print w/replies, xml ) Need Help??


in reply to Re: Rounding values upwards on an arbitrary basis
in thread Rounding values upwards on an arbitrary basis

Well, the bizarre thing about this problem is that the function ibanix described is not idempotent. E.g. f(124)=125 but f(f(124))=150. So it shouldn't really be called a "rounding" function. I don't know if that's really what he wanted, but it is what he asked for.

Abigail's function is more reasonable, but not what ibanix asked for.

  • Comment on Re: Re: Rounding values upwards on an arbitrary basis

Replies are listed 'Best First'.
Re: Rounding values upwards on an arbitrary basis
by Abigail-II (Bishop) on Jul 02, 2003 at 21:12 UTC
    Yeah, well you could solve that by adding something like:
    $new += $frac if int ($_ / $frac) == ceil ($_ / $frac);

    Abigail

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-20 00:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found