• 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: Bug in iTunes?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in iTunes?


  • Subject: Re: Bug in iTunes?
  • From: Kai <email@hidden>
  • Date: Mon, 09 Jun 2003 21:52:56 +0100

on Mon, 9 Jun 2003 15:30:44 +0100, Nigel Garvey wrote:

> [Regarding a method to increment positive integers and decrement negative
> ones, except when they're divisible by 20]

I missed those intermediate values. Well spotted, Nigel! :-)

>> ... you could use a slight variation on Kai's *very* nice method: :-)
>>
>> set v to 42
>> if (v mod 20) is not 0 then set v to v + (v + 1) div v * 2 - 1
>
> Drat! This gives the wrong answer when v = 1. :-(

My fault for not testing every value! How about:

if (v mod 20) is not 0 then set v to v + (v + 0.5) div v * 2 - 1

(I opted for 0.5 because it lies exactly halfway between 0 and 1 - but
almost any other value greater than 0 and less than 1 seems to work.)

--
Kai
_______________________________________________
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.

  • Prev by Date: Re: Date math question
  • Next by Date: Re: Date math question
  • Previous by thread: Re: Bug in iTunes?
  • Next by thread: Re: classic disables eppc?
  • Index(es):
    • Date
    • Thread