mirror of
				https://github.com/python/cpython.git
				synced 2025-11-02 22:51:25 +00:00 
			
		
		
		
	bpo-23460: Fix documentation for decimal string :g formatting (GH-11850)
This commit is contained in:
		
							parent
							
								
									1a53c785e6
								
							
						
					
					
						commit
						1660a61a10
					
				
					 2 changed files with 5 additions and 3 deletions
				
			
		| 
						 | 
					@ -500,9 +500,10 @@ The available presentation types for floating point and decimal values are:
 | 
				
			||||||
   |         |                                                          |
 | 
					   |         |                                                          |
 | 
				
			||||||
   |         | The precise rules are as follows: suppose that the       |
 | 
					   |         | The precise rules are as follows: suppose that the       |
 | 
				
			||||||
   |         | result formatted with presentation type ``'e'`` and      |
 | 
					   |         | result formatted with presentation type ``'e'`` and      |
 | 
				
			||||||
   |         | precision ``p-1`` would have exponent ``exp``.  Then     |
 | 
					   |         | precision ``p-1`` would have exponent ``exp``.  Then,    |
 | 
				
			||||||
   |         | if ``-4 <= exp < p``, the number is formatted            |
 | 
					   |         | if ``m <= exp < p``, where ``m`` is -4 for floats and -6 |
 | 
				
			||||||
   |         | with presentation type ``'f'`` and precision             |
 | 
					   |         | for :class:`Decimals <decimal.Decimal>`, the number is   |
 | 
				
			||||||
 | 
					   |         | formatted with presentation type ``'f'`` and precision   |
 | 
				
			||||||
   |         | ``p-1-exp``.  Otherwise, the number is formatted         |
 | 
					   |         | ``p-1-exp``.  Otherwise, the number is formatted         |
 | 
				
			||||||
   |         | with presentation type ``'e'`` and precision ``p-1``.    |
 | 
					   |         | with presentation type ``'e'`` and precision ``p-1``.    |
 | 
				
			||||||
   |         | In both cases insignificant trailing zeros are removed   |
 | 
					   |         | In both cases insignificant trailing zeros are removed   |
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					The documentation for decimal string formatting using the `:g` specifier has been updated to reflect the correct exponential notation cutoff point. Original patch contributed by Tuomas Suutari.
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue