• Robert Griesemer's avatar
    math/big: add support for underscores '_' in numbers · cfa93ba5
    Robert Griesemer authored
    The primary change is in nat.scan which now accepts underscores for base 0.
    While at it, streamlined error handling in that function as well.
    Also, improved the corresponding test significantly by checking the
    expected result values also in case of scan errors.
    
    The second major change is in scanExponent which now accepts underscores when
    the new sepOk argument is set. While at it, essentially rewrote that
    function to match error and underscore handling of nat.scan more closely.
    Added a new test for scanExponent which until now was only tested
    indirectly.
    
    Finally, updated the documentation for several functions and added many
    new test cases to clients of nat.scan.
    
    A major portion of this CL is due to much better test coverage.
    
    Updates #28493.
    
    Change-Id: I7f17b361b633fbe6c798619d891bd5e0a045b5c5
    Reviewed-on: https://go-review.googlesource.com/c/go/+/166157Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
    cfa93ba5
intconv_test.go 10 KB