• 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
Problem with Float type variable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with Float type variable


  • Subject: Problem with Float type variable
  • From: Adil Saleem <email@hidden>
  • Date: Fri, 14 Aug 2009 23:46:02 -0700 (PDT)

Hi,
 
I am getting a strange error that i am unable to understand.
 
I have a float type variable for which i have defined the getter and setter methods. However, when i set its value from within my application, it changes the value and the setter method gets wrong value.
 
Example:
-(float)myvar
{
  return myvar;
}
-(void)setMyvar:(float)aFloat
{
  myvar = aFloat;
}
 
.....
[classObject setMyvar:863.6];
 
On calling this, the variable aFloat in setMyvar method gets value 863.599976. I also tried giving it 6.600000 but still didn't work correctly. I don't understand why is it changing the value. Why doesn't it get 863.6 ?
 
Thank You in advance
 



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Problem with Float type variable
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Multi-User DB That Talks to Core Data?
  • Next by Date: Re: Problem with Float type variable
  • Previous by thread: Re: Timer in drawing loop performance problems
  • Next by thread: Re: Problem with Float type variable
  • Index(es):
    • Date
    • Thread