• 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: Random number generator -- OS X different
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Random number generator -- OS X different


  • Subject: Re: Random number generator -- OS X different
  • From: Daniel Robinson <email@hidden>
  • Date: Tue, 24 Apr 2001 22:01:45 -0400

Richard et al,

>At least you aren't using round!

hehehe

No, but OS X did and therein lies the rub.

--Dan

------------------------------------------------------------------------
Richard 23 wrote:

> >It was brought to my attention by Bill Fancher that when run on OS X,
> >Script A, posted yesterday, gave skewed results.
> >
> >After stepping through, I find that the error occurred when OS X rounded
> >the results to a an integer. In Script B, adding 0.5 to the result
> >solves the problem.
>
> > set ThisNumber to {(the result + 0.05) * 10} as integer
>
> I'm not sure that one should expect much better than "skewed" results
> using a single-item list trick to get an integer coercion to work in a
> way that I very much doubt it was designed for.
>
> I'm guessing that div, designed to take floating point input returning
> and return an integer result would probably be more reliable and
> efficient.
>
> set ThisNumber to ((result + 0.05) * 10) div 1
>
> But then I'm probably missing the whole point of this numerical voodoo.
>
> At least you aren't using round!
>
> R23
> _______________________________________________
> applescript-users mailing list
> email@hidden
> http://www.lists.apple.com/mailman/listinfo/applescript-users


References: 
 >Re: Random number generator -- OS X different (From: Richard 23 <email@hidden>)

  • Prev by Date: Re: Non-modal information window showing progress?
  • Next by Date: Re: Keyboard functions
  • Previous by thread: Re: Random number generator -- OS X different
  • Next by thread: Best way to check for hour?
  • Index(es):
    • Date
    • Thread