site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=memo.tv; h=Received:Cc:Message-Id:From:To:In-Reply-To:Content-Type:Mime-Version:Subject:Date:References:X-Mailer:X-Identified-User; b=rGVG+h4euNQjCUa1ydSnRnegrVkhKUxqqimWdDnkYMJwWzMPu3/CNEPlKGrk7KgVfyXNKWrI0zErD4d+Dr4dBQb2rA9UPi21+SOSpaFhXvkXz7mPOodSxcQegKfNhm/6; I'm guessing cornerSize is an int? you want to do i/(float) cornerSize ------------------------------------------- Memo (Mehmet S. Akten) www.memo.tv On 30 Sep 2008, at 12:29, Michael Robinson wrote: Hello, I am trying to convert the following from Javascript to Cocoa ObjC: return retVal; This is what I've got: float retVal; retVal = cornerSize*(1-cos(asin(i/cornerSize))); return (int)retVal; What what whaaaaat? I'm pretty stuck here, and would appreciate any help. Thanks Mike - - - Errors have occurred. We won't tell you where or why. Lazy programmers. - - - Charlie Gibbs _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/memo%40memo.tv _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.apple... so i/cornerSize will always return 0, so asin(i/cornerSize) will always return 0 so cos(asin(i/cornerSize)) will always return 1 so (1- cos(asin(i/cornerSize))) will always return 0 var retVal = Math.round(cornerSize*(1-Math.cos(Math.asin(i/ cornerSize)))); Now retVal _must_ be an int, because the value is used as a margin attribute ("rounding" corners of divs). Variables i, cornerSize are passed to the function from a for loop. i being the counter for the loop, cornerSize being the size of corner desired by the user. Obviously, I'm no whiz at ObjC, and the fact that this keeps return '0' has got me stumped. At first I thought it was some stupid mistake I made translating the formula, but I tested a few things and now I'm not so sure. sin(90); returns 0 as well. When I use Apple's Calculator and ask it to tell me the result of sin(90), it gives me 1. Do I need to import something for this to work? Am I not tilting my head in the correct direction while typing my code? This email sent to memo@memo.tv This email sent to site_archiver@lists.apple.com