• 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: magic integer converter number 62?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: magic integer converter number 62?


  • Subject: Re: magic integer converter number 62?
  • From: Nigel Garvey <email@hidden>
  • Date: Thu, 22 Feb 2001 15:09:46 +0000

Nigel Smith wrote on Thu, 22 Feb 2001 10:39:08 +0000:

>NG suggested using
>
> num div 1
>
>in response to MShaw's need to recreate(?)
>
>on floor(num)
> return (((100 + (num - (num mod 1))) - 100) as integer)
>end int
>
>
>I may be wrong, I'm no programmer, but isn't floor *always* rounding down?

I'd never heard the term before, so I just offered something that did the
same as the handler, which rounds towards zero. What you say sounds
likely though, so I apologise if my suggestion wasn't right for the job.

>on floor(num)
> if num < 0 then
> return (num div 1) - 1
> else
> return num div 1
> end if
>end floor
>
>...should do the business (though someone is bound to point out a quicker
>way!).

I devoted some time last year to writing my own fast rounding handlers,
and your effort consistently beats my rounding-down handler (today, at
least) by a few ticks over a few thousand iterations on my 4400.

NG


  • Prev by Date: Re: FS upgrade to MacOS X
  • Next by Date: Re: magic integer converter number 62? - Joking???
  • Previous by thread: Re: magic integer converter number 62?
  • Next by thread: Re: magic integer converter number 62?
  • Index(es):
    • Date
    • Thread