Re: (was Int Function) mod bug
Re: (was Int Function) mod bug
- Subject: Re: (was Int Function) mod bug
- From: email@hidden (Michael Sullivan)
- Date: Mon, 19 Aug 2002 19:58:03 -0400
- Organization: Society for the Incurably Pompous
>
email@hidden (Deivy Petrescu) writes:
>
>
> set x to 62
>
> set b to ((x + (2.6 - (2.6 mod 1))) - x) as integer
>
>
>
> now try this:
>
>
>
> set x to 61
>
> set b to ((x + (2.6 - (2.6 mod 1))) - x) as integer
>
>
I ran into this in PseudoRand, and some other similar code.
>
AFAICT, this never produces a bad answer:
>
>
set x to 61
>
set b to (((x + (2.6 - (2.6 mod 1))) - x) div 1) as integer
Ooops. I mean that *this* never produces a bad answer, unless you're
working close to the limits of FP precision:
set x to 61
set b to (((((x + (2.6 - (2.6 mod 1))) - x) + 5.0E-12) div 1) as
[NO-BREAK]integer)
Michael
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.