Re: confused about floats

2010-10-09 Thread Velocityboy
On Oct 9, 2010, at 3:12 PM, Ariel Feinerman wrote: > 2010/10/9 Kyle Sluder > >> >> In fact, I can't think of a situation when it *ever* makes sense to >> type something as id rather than NSObject. >> >> Because you can wish to use your own root class, there is difference > between these. I d

Re: confused about floats

2010-10-09 Thread Ariel Feinerman
2010/10/9 Kyle Sluder > > In fact, I can't think of a situation when it *ever* makes sense to > type something as id rather than NSObject. > > Because you can wish to use your own root class, there is difference between these. I dont know, but maybe it is why the delegates is always has: id , it

Re: confused about floats

2010-10-09 Thread Kyle Sluder
On Sat, Oct 9, 2010 at 10:38 AM, Ariel Feinerman wrote: >       NSObject *kit; >>        kit = [[kits selectedObjects] objectAtIndex:0]; >> > > // it is more convenience > id kit; Why would you do this? It is not more convenient. It is actually a hell of a lot less convenient, because now the co

Re: confused about floats

2010-10-09 Thread Ariel Feinerman
NSObject *kit; >kit = [[kits selectedObjects] objectAtIndex:0]; > // it is more convenience id kit; -- best regards Ariel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments t

Re: confused about floats

2010-10-09 Thread Gregory Weston
Kyle Sluder wrote: > Just wanted to confirm that this is a repost of the previous thread? > > http://lists.apple.com/archives/cocoa-dev/2010/Oct/msg00117.html > > --Kyle Sluder > > On Tue, Oct 5, 2010 at 2:07 AM, Amy Heavey > wrote: >> ... It is. Notice that it came through on Oct 8, dated O

Re: confused about floats

2010-10-08 Thread Kyle Sluder
Just wanted to confirm that this is a repost of the previous thread? http://lists.apple.com/archives/cocoa-dev/2010/Oct/msg00117.html --Kyle Sluder On Tue, Oct 5, 2010 at 2:07 AM, Amy Heavey wrote: > I've got two float values (x and y) that I'm using to change the coordinates > of a drawing act

Re: confused about floats

2010-10-08 Thread Murat Konar
A stripped down version of your code works as expected here. - (IBAction) test:(id) sender { //set coordinates to x,y -> 0,0 to start float x = 0; float y = 0; while (YES) { NSLog(@"x = %f, y = %f", x, y); x = x+100; //if coordinates are too

confused about floats

2010-10-08 Thread Amy Heavey
I've got two float values (x and y) that I'm using to change the coordinates of a drawing action that is being looped through. I can add a value to x and it draws the next image along, but I want to test the value of x and if it is out of bounds I want to reset it to zero and increase y, so

Re: Confused about floats

2010-10-05 Thread Matt Neuburg
On 10/5/10 10:18 AM, thus spake "Amy Heavey" : >I'm googling Fast Enumeration, but I'm compiling for 10.5, > > Fast enumeration is present in 10.5. m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ pantes anthropoi tou eidenai oregontai phusei Among the 2007 MacTech Top 2

Re: Confused about floats

2010-10-05 Thread Scott Ribe
On Oct 5, 2010, at 11:18 AM, Amy Heavey wrote: > I changed it to > 299 and voila it worked. I did also have to (is the term > cast?) the 299 to a float. Yes, the term is "cast". No you didn't need to cast 299 to a float. It's not wrong to do so, just unnecessary. (And, if you care, you could

Re: Confused about floats

2010-10-05 Thread Amy Heavey
Got it working, Part of my issue seemed to be my logic. 300 is the bounds of my target image, and I have planned it so images fit inside this, so x would end up being 300. In a stupid moment, I set the if statement to run if x>300, which initially it wouldn't be as it would actually equal 3

Re: Confused about floats

2010-10-05 Thread Scott Ribe
On Oct 5, 2010, at 9:32 AM, Shawn Bakhtiar wrote: > However, for clarity of the OP, x = x + y where y is an int, should be > typecast correctly as x = x + (float)y Why? The two are exactly equivalent. Now if you want to do so as a stylistic preference, that's fine, but there's no "should" abo

Re: Confused about floats

2010-10-05 Thread Velocityboy
loat)y > > Personally when I am writing code, I always write as x = x + 1.0 for clarity > as well. > > Sorry for not understanding the rebuttal :*) > > >> Subject: Re: Confused about floats >> From: scott_r...@killerbytes.com >> Date: Tue, 5 Oct 2010 09:24

Re: Confused about floats

2010-10-05 Thread Amy Heavey
Thanks for all the help everyone, I'll take a look at it all, and release where I need to! Many Thanks Amy On 5 Oct 2010, at 4:17PM, Matt Neuburg wrote: On Tue, 5 Oct 2010 10:17:31 +0100, Amy Heavey > said: //select all images for kit NSArray* kitImages = [kit valueForKeyPath:@"kitI

RE: Confused about floats

2010-10-05 Thread Shawn Bakhtiar
)y Personally when I am writing code, I always write as x = x + 1.0 for clarity as well. Sorry for not understanding the rebuttal :*) > Subject: Re: Confused about floats > From: scott_r...@killerbytes.com > Date: Tue, 5 Oct 2010 09:24:13 -0600 > CC: cocoa-dev@lists.apple.com &

Re: Confused about floats

2010-10-05 Thread Corbin Dunn
On Oct 5, 2010, at 2:17 AM, Amy Heavey wrote: > I've got two float values (x and y) that I'm using to change the coordinates > of a drawing action that is being looped through. I can add a value to x and > it draws the next image along, but I want to test the value of x and if it is > out of b

Re: Confused about floats

2010-10-05 Thread Velocityboy
t; > Can you please explain? > > I have plenty of C code, in *.c files that would disagree with you. > > You may be correct in that in Objective-C this may no longer be an issue, as > the compiler does your work for you, but that was not an assumption I was > making. > &g

Re: Confused about floats

2010-10-05 Thread Scott Ribe
On Oct 5, 2010, at 9:16 AM, Shawn Bakhtiar wrote: > Did you just call typecasting "*completely* unnecessary and pointless"... No, I called typecasting an int type to a floating type, in order to add it to a floating type, unnecessary and pointless. > You may be correct in that in Objective-C t

Re: Confused about floats

2010-10-05 Thread Kyle Sluder
On Tue, Oct 5, 2010 at 8:20 AM, Kyle Sluder wrote: > The arithmetic conversion rules say that the integer literals will be > promoted to the appropriate floating point type. So this is perfectly > fine and does exactly what you expect: P.S. The promotion doesn't only apply to literals but to othe

Re: Confused about floats

2010-10-05 Thread Kyle Sluder
On Tue, Oct 5, 2010 at 8:16 AM, Shawn Bakhtiar wrote: > > > Eh? > > Did you just call typecasting  "*completely* unnecessary and pointless"... No, he called the specific casting you were performing unnecessary and pointless, which it is. The arithmetic conversion rules say that the integer liter

Re: Confused about floats

2010-10-05 Thread Matt Neuburg
On Tue, 5 Oct 2010 10:17:31 +0100, Amy Heavey said: >//select all images for kit > NSArray* kitImages = [kit >valueForKeyPath:@"kitItems.kitItemProduct.productImage"]; > >//set coordinates to x,y -> 0,0 to start >float x = 0; >float y = 0; >//for each image >NSEnume

RE: Confused about floats

2010-10-05 Thread Shawn Bakhtiar
r you, but that was not an assumption I was making. > Subject: Re: Confused about floats > From: scott_r...@killerbytes.com > Date: Tue, 5 Oct 2010 08:56:45 -0600 > CC: cocoa-dev@lists.apple.com > To: shashan...@hotmail.com > > On Oct 5, 2010, at 8:51 AM, Shawn Bakhtiar wro

Re: Confused about floats

2010-10-05 Thread Scott Ribe
On Oct 5, 2010, at 8:51 AM, Shawn Bakhtiar wrote: > Also if x is a float, make sure you use the proper type cast, or values, ie > ( x = x + 120.00) or (x = y + (double)z , where x and y are double and z is > an int). That is *completely* unnecessary and pointless. -- Scott Ribe scott_r...@e

RE: Confused about floats

2010-10-05 Thread Shawn Bakhtiar
5 Oct 2010 09:27:31 -0400 > To: cocoa-dev@lists.apple.com > Subject: Re: Confused about floats > > Amy Heavey wrote: > > > I've got two float values (x and y) that I'm using to change the > > coordinates of a drawing action that is being looped through. I

Re: Confused about floats

2010-10-05 Thread Gregory Weston
Amy Heavey wrote: > I've got two float values (x and y) that I'm using to change the > coordinates of a drawing action that is being looped through. I can > add a value to x and it draws the next image along, but I want to test > the value of x and if it is out of bounds I want to reset it t

Confused about floats

2010-10-05 Thread Amy Heavey
I've got two float values (x and y) that I'm using to change the coordinates of a drawing action that is being looped through. I can add a value to x and it draws the next image along, but I want to test the value of x and if it is out of bounds I want to reset it to zero and increase y, so