mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Intern static string
Use float constructors instead of magic code for float constants
This commit is contained in:
		
							parent
							
								
									8e4997390c
								
							
						
					
					
						commit
						c8a0d2f368
					
				
					 2 changed files with 2 additions and 12 deletions
				
			
		|  | @ -14,17 +14,7 @@ | |||
| 
 | ||||
| FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL | ||||
| 
 | ||||
| 
 | ||||
| def _floatconstants(): | ||||
|     import struct | ||||
|     import sys | ||||
|     _BYTES = '7FF80000000000007FF0000000000000'.decode('hex') | ||||
|     if sys.byteorder != 'big': | ||||
|         _BYTES = _BYTES[:8][::-1] + _BYTES[8:][::-1] | ||||
|     nan, inf = struct.unpack('dd', _BYTES) | ||||
|     return nan, inf, -inf | ||||
| 
 | ||||
| NaN, PosInf, NegInf = _floatconstants() | ||||
| NaN, PosInf, NegInf = float('nan'), float('inf'), float('-inf') | ||||
| 
 | ||||
| 
 | ||||
| def linecol(doc, pos): | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Christian Heimes
						Christian Heimes