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 3991298
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:35:55+00:00 2026-05-20T06:35:55+00:00

Ok, this is so impossible that I don’t really know how to ask. I’m

  • 0

Ok, this is so impossible that I don’t really know how to ask. I’m developing an iPhone app, and at one point I needed to use NSOperation for some background task. The problem is that even the simplest float calculation it’s trimmed after the point (eg 1/2= 1.0). Initially I thought that’s a concurrency problem but then I tried:

NSLog(@"%f", 1/2);

And it logged 1.00000. How is this even possible? Surely I do something wrong!

Any ideas anyone?

  • 1 1 Answer
  • 0 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-20T06:35:56+00:00Added an answer on May 20, 2026 at 6:35 am

    You are dividing two integers, which then rounds up to 1.
    If you want to divide two floating point variables, either first save the values into a float and divide it or write .0f at the end of your value to tell the compiler that you are working with a float. Eg: 1.0f / 2.0f

    Just writing 1.0 / 2.0 like suggested in the comments will result in a division of two doubles, as the compiler will default the values to double.

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

Sidebar

Related Questions

I'm concerned that this is impossible, because +setAnimationDelegate: of UIView is a class method.
I suspect this is impossible, but thought I'd ask. Say I have a class
In Python 3 one can use super() instead of super(MyClass, self) , but this
I suspect that this is impossible, but I'm trying to be optimistic... I'm running
I need some help. Don't know if this is possible. I want to have
a long time ago I learned that this is a bad idea. Please don't
I recently found that this is impossible in SQLite: SELECT * FROM fruit WHERE
This seems impossible but I will ask anyway. Here is the scenario I have
One CSS rule I have learned is that you should use the relative em
Ok this is seemingly impossible to get right. I have a text box and

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.