• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Round Handler, care to share.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Round Handler, care to share.


  • Subject: Re: Round Handler, care to share.
  • From: Nigel Garvey <email@hidden>
  • Date: Thu, 7 Dec 2000 12:14:01 +0000

"Bourque, Jason" wrote on Wed, 6 Dec 2000 15:35:23 -0500:

>Hello,
>
>Does anyone have a vanilla handler that finds the next rounded value of a
>number, this is to be used in charts.
>
>i.e. 17.2 rounded would be 20
>
>22.8 rounded would be 25

It was fascinating to see all the different replies to this. Has everyone
else been working on alternatives to 'round' as well?

Reviews:
Carl's: Rounds up numbers that are already multiples of 5, doesn't work
with negatives. (But then that wasn't a stipulation.)
Arthur's: Ditto. Begins to lag behind on numbers greater than about
25....
WRATH1's: Very effective on all counts.
Marc's: Dodgy use of floating-point resolution. Doesn't work with
negatives.
Mine: Rounds away from zero when 'up' would perhaps be more
appropriate. Easily cured by removing the middle line (and changing the
handler's name!)

NG


  • Prev by Date: Re: Round Handler, care to share.
  • Next by Date: Script Server?
  • Previous by thread: Re: Round Handler, care to share.
  • Next by thread: Re: Selecting entire line in BBedit
  • Index(es):
    • Date
    • Thread