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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:17:57+00:00 2026-05-12T08:17:57+00:00

Imagine I write a simple calculator application, that just calculates simple stuff like 1.5

  • 0

Imagine I write a simple calculator application, that just calculates simple stuff like

1.5 + 30 + 9755 – 30 – 20000 + 999900.54

I remember slightly that there were some precision problems when using floating point numbers. At which point would my calculator app start to create wrong results? Most of the time, I would just calculate integers like 1 + 2 – 963422, but sometimes I may enter a floating point number. I have no big clue about where the precision problems would start to take effect. just the very last numbers of that double? like -963419.0000000000003655? Or how would that look like? And any idea how to catch those?

  • 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-12T08:17:57+00:00Added an answer on May 12, 2026 at 8:17 am

    Citing Wikipedia:

    In addition to loss of significance,
    inability to represent numbers such as
    π and 0.1 exactly, and other slight
    inaccuracies, the following phenomena
    may occur:

    • Cancellation: subtraction of nearly equal operands may cause extreme loss
      of accuracy. This is perhaps the most
      common and serious accuracy problem.
    • Conversions to integer are not intuitive: converting (63.0/9.0) to
      integer yields 7, but converting
      (0.63/0.09) may yield 6. This is
      because conversions generally truncate
      rather than round. Floor and ceiling
      functions may produce answers which
      are off by one from the intuitively
      expected value.
    • Limited exponent range: results might overflow yielding infinity, or
      underflow yielding a subnormal number
      or zero. In these cases precision will
      be lost.
    • Testing for safe division is problematic: Checking that the divisor
      is not zero does not guarantee that a
      division will not overflow and yield
      infinity.
    • Testing for equality is problematic. Two computational
      sequences that are mathematically
      equal may well produce different
      floating-point values. Programmers
      often perform comparisons within some
      tolerance (often a decimal constant,
      itself not accurately represented),
      but that doesn’t necessarily make the
      problem go away.

    In order to avoid such problems, you need to analyze your specific calculations in order to minimize error propagation.

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

Sidebar

Related Questions

I am trying to write a very simple application that allows me to enter
Imagine that you have a simple site with only 2 pages: login.aspx and secret.aspx.
I'm trying to write a simple script that will list the contents found in
I imagine that I should write a git commit hook (post-merge?) that would look
Imagine we have a program trying to write to a particular file, but failing.
Imagine you homebrew a custom gui framework that doesn't use windows handles (compact framework,
Imagine a web application written in Ruby on Rails. Part of the state of
It's often the case that I can write a nice tight little VB.NET function,
I am attempting to write some code that will expediently process video frames. I
I'm trying to write a super-simple podcast-to-device downloading service to use for running. I

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.