-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add string operation for int256 in Strings.sol #3758
Comments
Partially solved in #3773, although there's no |
What would the Hex representation of a negative integer be? If you want the 2-complement representation, just hard-cast the int256 to a uint256 and then do |
I'd say there would be multiple Hex representations available, but that should be an standard so hold on for now. |
I'd say there should not be multiple representations available in our libraries. Any user is free to chose one they like, and implement it on top of what we already have. |
I completely agree with not supporting them all, but I don't know about any way of generalizing it, and there's no standard usage afaik
This is the most general version I'd think about. Can be converted to 2's complement. |
I'd like to says that I've never seen anyone write |
Can you share a source (if any)? I haven't seen any two's complement on-chain, but maybe reaching out to people who's done it might be helpful |
I don't have any sources, because I have never seen anyone do When users ask for features, we ask them what their motivation/usecase is, and evaluate if that is relevant to the community in general. |
I am working on this issue, please assign this to me |
I'm not sure why this issue is not already closed, but we already have an implementation of |
🧐 Motivation
There is no implementation of the conversion of int256 to String
📝 Details
Using Strings.sol , We can convert uint256 to String,HexString and address to HexString. But int256 to string is required in many cases.
The text was updated successfully, but these errors were encountered: