I'm trying to convert big numbers (big.Int or even better big.Rat) to hex values.
I'm always having issue converting number when they are negative 0xff..xx or Fixed numbers.
Is there a way to do that?
I'm trying to convert big numbers (big.Int or even better big.Rat) to hex values.
I'm always having issue converting number when they are negative 0xff..xx or Fixed numbers.
Is there a way to do that?
Copyright © 2021 Jogjafile Inc.
Not sure what kind of issues are you having, but big.Int, big.Float and big.Rat implement the
fmt.Formatterinterface, you can use the printf family with the %x %X to convert to hexadecimal string representation, example:https://play.golang.org/p/BVh7wAYfbF