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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:56:51+00:00 2026-05-22T16:56:51+00:00

Why So ? >>> round(2/3) 0.0 >>> round(0.66666666666666666666666666666667) 1.0 >>> round(2.0/3) 1.0

  • 0

Why So ?

>>> round(2/3)

0.0

>>> round(0.66666666666666666666666666666667)

1.0

>>> round(2.0/3)

1.0

  • 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-22T16:56:52+00:00Added an answer on May 22, 2026 at 4:56 pm

    That’s not strange behaviour from round():

    Try this:

    >>> 2/3
    0
    

    Using / with two integer values will do an integer division. So the argument to round() is already 0, which makes round() return 0.

    Update: as @Mark noted in the comment, this behaviour changed in Python 3: 2/3 will do a floating point division as 2.0/3 does in Python 2. 2//3 can be used to get integer division behaviour on both versions).

    Your last example works, because 2.0 is not integer, so 2.0/3 will do a “propper” floating point division:

    >>> 2.0/3
    0.6666666666666666
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

round(45.923,-1) gives a result of 50. Why is this? How it is calculated? (sorry
To round a number I use the following code: public static roundBd(BigDecimal bd){ BigDecimal
Going round in circles here i think. I have an activity called Locate; public
Possible Duplicate: How to round a number to n decimal places in Java I
How do I round numbers up or down depending on the value in object
I need to round floating point numbers up to the nearest integer, even if
I want to round a float number to a given precision, for example :
There is a round circle in the center of my app. With a 480x800
Is trunc and round the same with negative arguments? SQL> select round(123456.76,-4) from dual;
I want to round numbers up to their nearest order of magnitude. (I think

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.