• 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: swift and objective-c
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: swift and objective-c


  • Subject: Re: swift and objective-c
  • From: Aaron Montgomery <email@hidden>
  • Date: Thu, 05 Jun 2014 08:02:15 -0700

On Jun 5, 2014, at 6:33 AM, Scott Ribe <email@hidden> wrote:
>
> On Jun 5, 2014, at 3:04 AM, Jeremy Pereira <email@hidden> wrote:
>
>> If I set y to -3, the definition becomes
>>
>> "The modulo operation is precisely defined, x mod -3 results in a positive integer between 0 and -4"
>>
>> That is clearly nonsense.
>
> It is not nonsense; it is the definition of modulo; look it up. (For instance: The Art of Computer Programming 3rd Ed Volume 1, Knuth, page 39; or Introduction to Algorithms 2nd Ed, Cormen, Leiserson, Rivest, Stein, page 851.)

Don’t have Knuth with me, but CLR 3rd edition requires the divisor to be positive and does not require the remainder (their term) or residue (their alternative term) to be positive (it requires it to be between 0 and one less than the divisor, inclusive).

Jeremy certainly has a point, as written, the statement becomes

“The modulo operation is precisely defined, x mod -3 results in a positive integer between 0 and -4”

means that it doesn’t exist (there aren’t any positive integers between 0 and -4. In fact as written, it won’t work for all positive divisors as well For example we would expect 4 mod 2 = 0, but under the definition, “4 mod 2” would need to be a positive integer between 0 and 1. However, the only positive integer between 0 and 1 is 1 (0 is not positive).

Aaron
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: swift and objective-c
      • From: Scott Ribe <email@hidden>
References: 
 >swift and objective-c (From: "McLaughlin, Michael P." <email@hidden>)
 >Re: swift and objective-c (From: Roland King <email@hidden>)
 >Re: swift and objective-c (From: Ron Hunsinger <email@hidden>)
 >Re: swift and objective-c (From: Jeremy Pereira <email@hidden>)
 >Re: swift and objective-c (From: Scott Ribe <email@hidden>)
 >Re: swift and objective-c (From: Jeremy Pereira <email@hidden>)
 >Re: swift and objective-c (From: Scott Ribe <email@hidden>)
 >Re: swift and objective-c (From: Jeremy Pereira <email@hidden>)
 >Re: swift and objective-c (From: Scott Ribe <email@hidden>)

  • Prev by Date: Re: swift and objective-c
  • Next by Date: Re: swift and objective-c
  • Previous by thread: Re: swift and objective-c
  • Next by thread: Re: swift and objective-c
  • Index(es):
    • Date
    • Thread