classification
Title: string format 'n' produces numbers with incorrect precision
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: eric.smith Nosy List: Jakub Szewczyk, eric.smith
Priority: normal Keywords:

Created on 2018-06-01 10:21 by Jakub Szewczyk, last changed 2018-06-01 12:26 by eric.smith. This issue is now closed.

Messages (3)
msg318388 - (view) Author: Jakub Szewczyk (Jakub Szewczyk) Date: 2018-06-01 10:21
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

>>> print ("{:.2n}".format(1.89))
1.9

>>> print ("{:.2f}".format(1.89))
1.89
msg318392 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2018-06-01 10:40
'n' is defined as the same as 'g', for floats (modulo the locale-specific characters, of course):

>>> format(1.89, '.2n')
'1.9'
>>> format(1.89, '.2g')
'1.9'
msg318405 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2018-06-01 12:26
I'm going to close this. If you still think there's an issue, we can re-open it.
History
Date User Action Args
2018-06-01 12:26:24eric.smithsetstatus: open -> closed
messages: + msg318405

assignee: eric.smith
components: + Interpreter Core, - Extension Modules
resolution: not a bug
stage: resolved
2018-06-01 10:40:52eric.smithsetmessages: + msg318392
2018-06-01 10:21:23Jakub Szewczykcreate