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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:45:59+00:00 2026-06-01T03:45:59+00:00

The reason I’m asking this is because there is a validation in OpenERP that

  • 0

The reason I’m asking this is because there is a validation in OpenERP that it’s driving me crazy:

>>> round(1.2 / 0.01) * 0.01
1.2
>>> round(12.2 / 0.01) * 0.01
12.200000000000001
>>> round(122.2 / 0.01) * 0.01
122.2
>>> round(1222.2 / 0.01) * 0.01
1222.2

As you can see, the second round is returning an odd value.

Can someone explain to me why is this happening?

  • 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-01T03:46:00+00:00Added an answer on June 1, 2026 at 3:46 am

    This has in fact nothing to with round, you can witness the exact same problem if you just do 1220 * 0.01:

    >>> 1220*0.01
    12.200000000000001
    

    What you see here is a standard floating point issue.

    You might want to read what Wikipedia has to say about floating point accuracy problems:

    The fact that floating-point numbers cannot precisely represent all real numbers, and that floating-point operations cannot precisely represent true arithmetic operations, leads to many surprising situations. This is related to the finite precision with which computers generally represent numbers.

    Also see:

    • Numerical analysis

    • Numerical stability

    A simple example for numerical instability with floating-point:
    the numbers are finite. lets say we save 4 digits after the dot in a given computer or language.
    0.0001 multiplied with 0.0001 would result something lower than 0.0001, and therefore it is impossible to save this result!
    In this case if you calculate (0.0001 x 0.0001) / 0.0001 = 0.0001, this simple computer will fail in being accurate because it tries to multiply first and only afterwards to divide. In javascript, dividing with fractions leads to similar inaccuracies.

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

Sidebar

Related Questions

The reason I'm asking is that this post http://amix.dk/blog/post/19577 Indicates that Node.js 0.2.2 seems
The reason I'm asking this is because right now I use an NSMutableSet of
The reason I am asking this is due to my observation that frameworks like
The reason why I am asking this is because I was recommended by @Greg
The reason why I'm asking this, is because I'm coding in C++, in putty/ssh
The reason I am asking this, is because extending the Similarity class or using
The reason I'm asking this is that our app (The Elements) runs fine on
The reason I am asking this question is because I have landed my first
The reason I am asking this is because it seems (for me) a lot
The reason for me asking this question is:- I get a real buzz out

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.