On 12 Aug 2014, at 00:41, Keary Suska cocoa-...@esoteritech.com wrote:
On Aug 11, 2014, at 2:52 PM, Dave d...@looktowindward.com wrote:
On 10 Aug 2014, at 16:16, Keary Suska cocoa-...@esoteritech.com wrote:
I don't think so, although I would expect a C lib somewhere to address it.
On Aug 12, 2014, at 1:42 AM, Dave d...@looktowindward.com wrote:
Maybe my brain isn't working correctly but that doesn't make sense to me.
Could you show the output with both x and y shown? Now, you aren't dividing
by a negative integer, are you? I believe that is undefined…
Yes, it's my
On 12 Aug 2014, at 15:01, Keary Suska cocoa-...@esoteritech.com wrote:
On Aug 12, 2014, at 1:42 AM, Dave d...@looktowindward.com wrote:
Maybe my brain isn't working correctly but that doesn't make sense to me.
Could you show the output with both x and y shown? Now, you aren't dividing
On Aug 12, 2014, at 10:01 AM, Dave d...@looktowindward.com wrote:
I’m not sure what you mean by dividing by a negative number is undefined?
It sure as hell better be defined, hadn't it? We wouldn't want a language where
the basic math ops were that foobar'd!
Now in KR C, the direction of
On 12 Aug 2014, at 17:11, Scott Ribe scott_r...@elevated-dev.com wrote:
On Aug 12, 2014, at 10:01 AM, Dave d...@looktowindward.com wrote:
I’m not sure what you mean by dividing by a negative number is undefined?
It sure as hell better be defined, hadn't it? We wouldn't want a language
At 3:24 PM -0600 8/11/14, Scott Ribe wrote:
On Aug 11, 2014, at 3:03 PM, Dave d...@looktowindward.com wrote:
The first edition of KR mistakenly referred to it as modulus
(apparently based on the PDP-11 instruction which was similarly
misnamed).
When in doubt, remember what C was designed to
On Aug 12, 2014, at 10:17 AM, Dave d...@looktowindward.com wrote:
On 12 Aug 2014, at 17:11, Scott Ribe scott_r...@elevated-dev.com wrote:
On Aug 12, 2014, at 10:01 AM, Dave d...@looktowindward.com wrote:
I’m not sure what you mean by dividing by a negative number is undefined?
It
On 10 Aug 2014, at 16:16, Keary Suska cocoa-...@esoteritech.com wrote:
I don't think so, although I would expect a C lib somewhere to address it.
Anyway, isn't easier to just always abs(x)%y?
abs(x)%y
Doesn’t give the same result:
myIndex: -5 myMod: 1 abs(x)%y: 2
myIndex: -4
On 10 Aug 2014, at 17:04, Scott Ribe scott_r...@elevated-dev.com wrote:
On Aug 10, 2014, at 9:16 AM, Keary Suska cocoa-...@esoteritech.com wrote:
I don't think so, although I would expect a C lib somewhere to address it.
I think the standard C libs only have floating-point versions of mod
In computing, the modulo (sometimes called modulus) operation finds the
remainder of division of one number by another.
Given two positive numbers, a (the dividend) and n (the divisor), a modulo n
(abbreviated as a mod n) is the remainder of theEuclidean division of a by n.
For instance, the
On Aug 11, 2014, at 3:03 PM, Dave d...@looktowindward.com wrote:
My conclusion is (a % b) in C is a remainder operator and NOT modulo operator.
Yes. The first edition of KR mistakenly referred to it as modulus (apparently
based on the PDP-11 instruction which was similarly misnamed). The
On Aug 11, 2014, at 3:15 PM, koko k...@highrolls.net wrote:
When either a or n is negative, the naive definition breaks down and
programming languages differ in how these values are defined.
But that is only because what you call the naive definition is incorrect. The
actual definition is
On 11 Aug 2014, at 22:15, koko k...@highrolls.net wrote:
In computing, the modulo (sometimes called modulus) operation finds the
remainder of division of one number by another.
Given two positive numbers, a (the dividend) and n (the divisor), a modulo n
(abbreviated as a mod n) is the
On 11 Aug 2014, at 22:24, Scott Ribe scott_r...@elevated-dev.com wrote:
On Aug 11, 2014, at 3:03 PM, Dave d...@looktowindward.com wrote:
My conclusion is (a % b) in C is a remainder operator and NOT modulo
operator.
Yes. The first edition of KR mistakenly referred to it as modulus
On 11 Aug 2014, at 22:26, Scott Ribe scott_r...@elevated-dev.com wrote:
On Aug 11, 2014, at 3:15 PM, koko k...@highrolls.net wrote:
When either a or n is negative, the naive definition breaks down and
programming languages differ in how these values are defined.
But that is only because
On Aug 11, 2014, at 2:52 PM, Dave d...@looktowindward.com wrote:
On 10 Aug 2014, at 16:16, Keary Suska cocoa-...@esoteritech.com wrote:
I don't think so, although I would expect a C lib somewhere to address it.
Anyway, isn't easier to just always abs(x)%y?
abs(x)%y
Doesn’t give
Hi,
I just got caught out by the C/Objective-C Implementation of the % (mod)
function in XCode C/Objective-C. I remember having this very same problem years
ago (after I solved it again this time).
It stems from the modulus (%) function not returning a true modulus for
negative numbers
On Aug 10, 2014, at 6:31 AM, Dave d...@looktowindward.com wrote:
I just got caught out by the C/Objective-C Implementation of the % (mod)
function in XCode C/Objective-C. I remember having this very same problem
years ago (after I solved it again this time).
It stems from the modulus
On Aug 10, 2014, at 9:16 AM, Keary Suska cocoa-...@esoteritech.com wrote:
I don't think so, although I would expect a C lib somewhere to address it.
I think the standard C libs only have floating-point versions of mod functions.
(That does seem like an odd omission.)
This would at least be a
19 matches
Mail list logo