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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:41:31+00:00 2026-05-16T02:41:31+00:00

Is (int)(int1 / (float)var2.Count() * 100) equivalent to (int)((int1 / (float)var2.Count()) * 100) …and

  • 0

Is

(int)(int1 / (float)var2.Count() * 100)

equivalent to

(int)((int1 / (float)var2.Count()) * 100)

…and will it use floating point or integer division?

Edit… if the answer is yes to the above, what is the advantage of performing a floating point division here?

  • 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-16T02:41:32+00:00Added an answer on May 16, 2026 at 2:41 am

    / and * have the same operator precedence, under §7.2.1 so the two results should be the same (using float rules).

    I, however, can’t be bothered to learn precedence tables; I just use brackets. Then it works in any language without needing to remember it.

    Another important question is the rounding in the final (int) cast: do you expect that to be “up”, “down” or “bankers”?

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

Sidebar

Related Questions

I have a type data Value = Int Integer | Float Double | Complex
I'm using std::unordered_map<std::tuple<int, int, int>, float> . However, VS2010 will not compile the instantiation.
Example class in pseudocode: class SumCalculator method calculate(int1, int2) returns int What is a
EDIT SOLUTION: A cylinder in openGL ES: ///Storing a cylinder in a VBO int
I have a merge sort and it will work when I do mergeSort<int>(val_array1,numValues); but
#include <iostream> #include <cmath> using namespace std; float f (int a, int b) {
I have string,int,float values and trying to assign those values to char* c[] array
This is what reflector gives: public int Int1 { get; set; } public string
def fibSeq(n: Int): List[Int] = { var ret = scala.collection.mutable.ListBuffer[Int](1, 2) while (ret(ret.length -
I am trying to read: (int 1) operator (int 2) or returnType (int 1)

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.