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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:03:36+00:00 2026-06-14T18:03:36+00:00

I am trying to convert a double value in to an exponential but I

  • 0

I am trying to convert a double value in to an exponential but I get a rounding error.

int main (unsigned int argc, char **argv)
{
    float a=293.17;
    float b=293.10;
    double ULfreq = 2089.555000;
    double upfreq = 0.0;
    long int t = 0;
    long int u = 0;

    upfreq = ULfreq * 1000000.0;

    printf(" %f, upfreq:%22.16E\n", upfreq, upfreq);

    return 0;
}

When I run this code on a 32-bit computer I get the following result:

2089555000.000000, upfreq:2.0895549999999998E+09

Running it on a 64-bit one gives the correct answer.

Is it possible to make this conversion work on a 32-bit server and how?

  • 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-14T18:03:37+00:00Added an answer on June 14, 2026 at 6:03 pm

    It’s not rounding error, but representation feature of floating points. Most short fractions such as 1.1 are infinite series in base 2 (as 1/3 = 0.3333… in base 10). Thus one has to clip it somewhere. When converted back to decimal, 2.08955499999 is what you get.

    In the first case you ask printf function to round it to the default precision of %f, which is 6 decimals after the decimal separator. In the second case you are asking 22 digits of precision and get that…

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

Sidebar

Related Questions

I'm trying to convert a string value to Double but I sill get error
I'm trying to get a double value with seconds to convert to a custom
I'm trying to convert a string to a double value but it's not returning
I'm trying to convert a string to a double value in .Net 3.5. Quite
I am trying to convert a string to a double value to use it
I am trying to convert a _string[1] to double and _string[2] to Int this
I am trying to convert string to double. But i am getting the number
I am trying to convert this C# code to F#: double[,] matrix; public Matrix(int
I'm trying to convert the value returned by Now() to double and then use
I'm trying to convert std::string to float/double . I tried: std::string num = 0.6;

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.