Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 994753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:37:10+00:00 2026-05-16T06:37:10+00:00

Ok here goes my situation: I have a core-data generated class Quantity which has

  • 0

Ok here goes my situation:

I have a core-data generated class Quantity which has one of its attributes ‘Value’, marked as a float.

There’s a convenience method in the Quantity class which helps me set this property:

- (void)setValueValue:(float)value_ {

    [self setValue:[NSNumber numberWithFloat:value_]];

}

Now when I set try set this value from a Controller like this,

Quantity *q = (Quantity *) [NSEntityDescription insertNewObjectForEntityForName:@"Quantity" inManagedObjectContext:self.managedObjectContext];

float qv = 100.0f;

[q setValueValue:qv];

the value gets set as 1.40129846e-43

I put breakpoints in both locations above, and while the tooltip correctly shows the value as 100.0 in the Controller class, it shows the incorrect value in the setter method.

And ultimately, the value that gets stored in the object and the db is the incorrect value.

Any clues as to what’s happening here??

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:37:11+00:00Added an answer on May 16, 2026 at 6:37 am

    1.40129846e-43 is a very interesting number, and tells us what’s happening here.

    Specifically:

    1.40129846e-43 = 100 * 2^-149
    

    More simply, the value that you’re observing is what you get if you interpret the integer value 100 as the encoding of a float.

    What is most likely happening is that you haven’t included the header that declares the setValueValue:(float) method, or that the declaration is otherwise not in scope at the location from which you are calling the method. This results in the compiler assuming that the method takes an integer argument instead of a floating-point argument.

    Thus, the caller converts your 100.f value into the integer 100, which is then interpreted by the function as the encoding of the floating-point number you are observing.

    The other possibility is that a similar type impedance mismatch is happening somewhere in your logging code.

    TLDR: make sure you declare your functions before you use them in C-based languages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having an issue with Core Data... here is my situation: I have
Weird to describe but here goes. I have a table with several rows. One
A slightly archaic question I'm afraid but here goes: I have a program which
Here's the situation. Let's say I have a class called MYFoo. Here's it's initializer:
I have a situation here. I have a redundant TCP server setup which takes
Here is the situation: I have a table value function with a datetime parameter
Ok here goes: I have a SELECT drop down option with US state names
I'm sure the answer is somehow logical but here goes. I have three big
Here's the situation I'm in: We have a field in our database that contains
I have a class DocumentGenerator which wraps a MemoryStream . So I have implemented

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.