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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:37:36+00:00 2026-06-11T06:37:36+00:00

Suppose I have a range from 0-100 & I choose a random number X

  • 0

Suppose I have a range from 0-100 & I choose a random number X say 29.

Now I increase the range to a big number say a 10-digit 1023654740.

Now I want to find the place of that X in 0-1023654740. (so that is I belive is 29% of 1023654740)

If I perform the calculation using Double, I’m getting an exponent value.

double range = 1023654740;
double position = 29;   // Can be any number from 0 - range
Double val = (((double) position / range) * 100);

Result: 2.8329864422842414E-6

But I want final result in int.(dont care if the final value is rounded off or truncated)

Any suggestions

  • 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-11T06:37:38+00:00Added an answer on June 11, 2026 at 6:37 am

    First, your calculation is wrong. According to your description, you probably want to do the following:

    Double val = ((double)position / 100) * range;
    

    Then you can get your int value (by truncation) through:

    int intVal = val.intValue();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have range from E2 to E16. How do I read values from
Suppose I have two tables, - emp(empId number(1),empName varchar2(50)) and - manager(manId number(5),managerName varchar2(100))
Suppose I have this range: (aaaaa..zzzzz) How would I get the Nth item from
So here is the question: Suppose you have 100 thousand integers which ranges from
Suppose I have a class Baz that inherits from classes Foo and Bar ,
How do I remove random items from a dictionary in Python? I have to
I have written a macro to find blank cells from a certain range using
Suppose I have one combo box and I am switching its data provider from
suppose i have a .on() function wherein i select multiple ids $(#i, #am, #your,
Suppose I have a large list of words. For an example: >>> with open('/usr/share/dict/words')

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.