uint256
uint256 copied to clipboard
Neg and Dec
Hi. Thank you for your code. This might be out of scope, but I wondered if Dec() should be prefixed with a "-" when Sign < 0.
package main
import (
"testing"
"github.com/holiman/uint256"
)
func TestDec(t *testing.T) {
a := uint256.MustFromHex("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
if a.Dec() != "-1" {
t.Errorf("want: -1 got: %s", a.Dec())
}
b := uint256.NewInt(0).Neg(uint256.NewInt(1))
if b.Dec() != "-1" {
t.Errorf("want: -1 got: %s", b.Dec())
}
}
--- FAIL: TestDec (0.00s)
main_test.go:12: want: -1 got: 115792089237316195423570985008687907853269984665640564039457584007913129639935
main_test.go:16: want: -1 got: 115792089237316195423570985008687907853269984665640564039457584007913129639935
```