- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 33.3k
gh-113804: Support formatting floats in hexadecimal notation #113805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Closed
      
      
    
  
     Closed
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            29 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      64ab5ed
              
                gh-113804: Support "x" and "X" format types for floats
              
              
                skirpichev 024b02d
              
                Address review: fix asserts
              
              
                skirpichev 005577c
              
                Merge branch 'main' into hex-format
              
              
                skirpichev 97134b9
              
                Merge branch 'main' into hex-format
              
              
                skirpichev e05059f
              
                Merge branch 'main' into hex-format
              
              
                skirpichev b73515f
              
                Expand news entry & change section
              
              
                skirpichev 7d47aef
              
                Merge branch 'master' into hex-format
              
              
                skirpichev 025de36
              
                Don't clear trailing zeros + misc for float.hex() compatibility
              
              
                skirpichev 8739f6b
              
                _Py_dg_dtoa_hex() got special option for float.hex()
              
              
                skirpichev 7525d1a
              
                Obviously, this is not going in 3.13...
              
              
                skirpichev 19e5083
              
                Merge branch 'main' into hex-format
              
              
                skirpichev faed5f3
              
                Merge branch 'main' into hex-format
              
              
                skirpichev 01b490e
              
                Merge branch 'master' into hex-format
              
              
                skirpichev 322a011
              
                Address review: revert changes in old-style formatting
              
              
                skirpichev 9621d36
              
                Address review: revert x/X formatting for complexes
              
              
                skirpichev e721305
              
                Apply suggestions from code review
              
              
                skirpichev 7c04f82
              
                address review: rename/document _hex option
              
              
                skirpichev e78b85c
              
                Merge branch 'master' into hex-format
              
              
                skirpichev d973c7a
              
                address review: move autoprec decl & comment on tohex_nbits const
              
              
                skirpichev 4940336
              
                address review: memory allocation
              
              
                skirpichev d1ff85e
              
                fix: catch PyMem_Malloc() error and document returned value
              
              
                skirpichev 089afe4
              
                fix: warnings
              
              
                skirpichev be84c10
              
                address review: _Py_dg_dtoa_hex -> _Py_float_to_hex
              
              
                skirpichev c98b092
              
                address review: round-to-even
              
              
                skirpichev e089ff5
              
                Merge branch 'master' into hex-format
              
              
                skirpichev 795d1da
              
                +
              
              
                skirpichev 58e84fd
              
                Merge branch 'master' into hex-format-test
              
              
                skirpichev 728671a
              
                cleanup
              
              
                skirpichev 4eaa4f8
              
                +1
              
              
                skirpichev File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            2 changes: 2 additions & 0 deletions
          
          2 
        
  Misc/NEWS.d/next/Core and Builtins/2024-02-29-05-06-03.gh-issue-113805.5oGkdZ.rst
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Support formatting floats (using "x" and "X" format types) in hexadecimal | ||
| notation, like ``0x1.2efp-2``. Patch by Sergey B Kirpichev. | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that digits can be upper or lower cases:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hexadecimal digits can:) I thought this was obvious from the context, so "hexadecimal" was omitted (doesn't fit to one line). I can add this.
I worry that in your version it might be not clear, that uppercase used not just for the prefix.