This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: round(number[, digits]) does not return value with >12 decimal places
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: john Forgue, mark.dickinson, steven.daprano
Priority: normal Keywords:

Created on 2017-07-08 03:07 by john Forgue, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg297928 - (view) Author: john Forgue (john Forgue) Date: 2017-07-08 03:07
I have a sensor that returns float with 15 decimal places.

Using  "round(number[, digits])" in a program I get no rounding

Using the same command in the terminal interpreter it returns
...   (3 periods) then hangs requiring ^C to continue.

I'm using Python 3.4.2 on RasPi Jessie.
msg297929 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2017-07-08 03:30
> Using  "round(number[, digits])" in a program I get no rounding

It works for me. Can you show an example of it not working?

py> round(1.23456789012345, 3)
1.235


> Using the same command in the terminal interpreter it returns
> ...   (3 periods) then hangs requiring ^C to continue.


That sounds like the interactive interpreter is waiting for a closing parenthesis (round bracket). It will sit and wait forever for you to finish typing the command. If you hit ENTER, you'll just get another prompt.

py> round(1.23456789012345, 3
...
...
... )
1.235


If this does not explain what you are seeing, you will have to give us more information, including examples of the failures and instructions for how to replicate the failure.
msg297959 - (view) Author: john Forgue (john Forgue) Date: 2017-07-08 16:26
I found a programming issue that circumvented the round function.  As for the terminal "verification" I reported.... I'm not sure what I did and cannot repeat.

Sorry for the false alarm.

John
History
Date User Action Args
2022-04-11 14:58:48adminsetgithub: 75058
2017-07-08 16:26:57john Forguesetstatus: open -> closed
resolution: works for me
messages: + msg297959

stage: resolved
2017-07-08 15:38:25mark.dickinsonsetnosy: + mark.dickinson
2017-07-08 03:30:08steven.dapranosetnosy: + steven.daprano
messages: + msg297929
2017-07-08 03:07:40john Forguecreate