k0kubun/pp

Feature request: Pretty print big.Int and big.Float?

quenbyako opened this issue · 5 comments

cause stuff like

&big.Int{
              neg: false,
              abs: big.nat{
                0x908f8474ea971baf,
              },
}

does look too messy to be honest. Also, some default cool things like http response, rsa keys, etc. could be looking more cool (only most popular, much of default types should be printed explicitly)

Could you please specify both "the current output" and "the expected output" for each type of values? Otherwise it may end up being just something you didn't expect.

@k0kubun my idea is:

change current output:

&big.Int{
              neg: false,
              abs: big.nat{
                0x908f8474ea971baf,
              },
}

to expected output like

3.14159265359*10^12345  // digits after dot divider is fixed on like 16 digits, or i don't know, i like 16

Yes, this is not go-valid string, but, you know, prette printed time.Time not too))))

Maybe, you have better representation of huge numbers, but i found this one as easy-to-read one

Thanks.

I was not sure what you imagined to implement 3.14159265359*10^12345, because abs is a private field unlike the time.Time case. So I end up just using String() because it's public. e143281

@k0kubun Thanks a lot!

Also, big numbers have Format() method. just for know, but deciminal representation looks more helpful!