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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:39:31+00:00 2026-06-12T14:39:31+00:00

I have things object called – bombObject, which has a float property called ‘blastRadius’.

  • 0

I have things object called – bombObject, which has a float property called ‘blastRadius’.

When ‘NSLog(@”%.2f”,bombObject.blastRadius);’ executes I get whatever i made it in the first pace e.g. 100 etc. But if execute: ‘NSLog(@”%.2f”,bombObject.blastRadius*(3/7));’ I don’t get 3/7 of the blastRadius, I get 0.00. However if i do ‘NSLog(@”%.2f”,(bombObject.blastRadius*3)/7);’ I get the desired answer.

Why is this?

Thanks in advanced!

  • 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-06-12T14:39:32+00:00Added an answer on June 12, 2026 at 2:39 pm

    An int/int will not promote to a float, so you end up with only an integer being returned. 3/7 is less than 1 so you end up truncating to 0. You then multiply bombObject.blastRadius by 0 which gives you the 0.00 answer you are seeing.

    Why does (bombObject.blastRadius*3)/7 work though? Because bombObject.blastRadius*3 is a float resultant; a float / int would become a float which is why it works in this instance.

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

Sidebar

Related Questions

I have an Active Record model object called Event, which has many event_things. I
I have a business model called Customer which has many required properties (via DataAnnotations)
I have a class called Type: class Type { ... } Which has a
I have been working on keeping things object oriented for my project. Currently, I'm
I have an object that has a list of 'observers'. These observers get notified
I have one custom ListView called AreasListView which I've included in the XML file.
I have an object called Reservations . Inside Reservations , there is a another
I am using VB.Net. I have an object class called clsA(of T as clsB).
I have a control which displays the state of an underlying asynchronous object. The
Hi I have an object called document and one called user Document public virtual

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.