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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:29:35+00:00 2026-06-14T23:29:35+00:00

I am interested in getting a tolerance range +- of e-8 for a data

  • 0

I am interested in getting a tolerance range +- of e-8 for a data type of double (8 bytes, 64 bits).

For example:
0.123456782456789

I would like to get the plus/minus tolerance range for this that is within 8 decimal places.

They would be:
low range = 0.123456781456789

high range = 0.123456783456789

Notice the difference in the 9th decimal place.

If the input is a double that is given in Hexadecimal. What do I need to add or minus from the hexadecimal? Since this is a double, it will contain 4 data words. Would I need to add/minus 256 (in decimal) from the 3rd data word?

For example:

3FBF 9ADD 1B1F 0D35 is the hex for 0.123456782456789

So… would the low and high range be:

3FBF 9ADD 1*A*1F 0D35

3FBF 9ADD 1*C*1F 0D35

  • 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-14T23:29:36+00:00Added an answer on June 14, 2026 at 11:29 pm

    To compute an interval [a, b] that includes the points that are within |x|•10-8 of x, set a and b:

    double t = fabs(x) * 1e-8;
    double a = x-t;
    double b = x+t;
    

    This is approximate because rounding errors could make a or b slightly inaccurate. If you want the interval to absolutely include all the points, you can use a slightly higher value than 1e-8, or you can use more advanced techniques.

    Some warnings:

    If you are using an interval as part of a test to determine whether some computed value is “almost equal to” another value, then determining how large the interval must be requires analysis of the floating-point operations used and the values involved. It is possible for floating-point values to produce errors ranging from zero to infinity, depending on the situation. It is not possible to state any single amount of tolerance that is useful in all situations, or even in “typical” situations.

    Determining how large the interval may be requires determining what errors are acceptable for your application. Accepting unequal values as equal to allow for computation errors means that your program will sometimes accept as equal values that are truly unequal (if computed exactly, with no errors). So you need to figure out how large the interval can be before your program produces unacceptable results.

    Obviously, if the interval must be larger than it may be, then your program is broken; this use of an interval cannot work. In such case, you must redesign the floating-point operations to produce less error or redesign the program otherwise to avoid this.

    It is generally a bad idea to use the representation of a floating-point number to read or alter its value. Doing so requires careful attention to details of your compiler or platform specification. (In particular, code that appears to work in tests, may actually be broken in the sense that it is not supported by the compiler and will break if a different version of the compiler is used or the compilation switches, such as switches for debugging and optimization, are changed.) Additionally, code to access the representation of a floating-point number is generally not portable. (Most notably, some platforms store the bytes of a double in “little endian“ order and some store the bytes in “big endian” order. There are other portability issues as well.) Even when code is correctly written to access the representation of a floating-point number, it may be slower than other methods.

    For tolerances as large as 10-8, it is likely sufficient to use 1e-8 to compute the interval. That is, you can use ordinary floating-point arithmetic, and it is not necessary to compute the ULP of a floating-point number or to access its representation. However, if you do want to compute the ULP of an IEEE-754 floating-point number, you can do so without accessing its representation using the code in this answer. That code is written for float rather than double, but you can change FLT to DBL to change the constants it uses. Also change float to double, of course.

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

Sidebar

Related Questions

I am interested into getting into bash scripting and would like to know how
I am interested in getting details from a Mysql table like it's type, length,
I interested to work with data types and file formats. For example I want
I'm interested in getting into C to get close to the metal performance, but
Suppose I have a table . Now, I'm interested in Getting Useful Data Easily.
I'm interested in getting the SQLite database containing browsing history from the built in
An easy one that I am interested in getting your thoughts on: With your
I have a multidimensional array, I am interested in getting all the elements (one
Probably a bit off topic question, but it's something I'm really interested in getting
I'm having trouble getting Spring.Net to log, using Log4Net. I'm particulary interested in seeing

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.