-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Differentiate the current from_str_radix
into signed and unsigned versions
#25
Comments
The implementation of |
So if I finish the division implementation, do you have all the necessary stuff to fix the function? |
With the division operation we could easily look at |
I have been using this crate to serialize strings into a fixed point format for a fractional integers crate I have not made public yet. I have been thinking about this for several days now, and I have arrived at two functions (with signed and unsigned variants) that could be called by all our other functions, and be used directly by end users for more complex and custom serialization. All of our other string serialization functions are only concerned with the integer part, so the Here is the rough draft documentation (note that this is not ready for compilation yet, and apologies for the lack of screen wrapping):
|
I will use |
The whole from_str serialization parts are super old and have never even been finished. Ideally I shouldn't have pushed them to master but it happened. So please feel free to completely revamp them as needed. |
I think my new goal is to fix this issue with robust string serialization and deserialization functions before university starts again. I have a fixed point way of removing the
This is completely robust if I use checked arithmetic (so that string lengths close to I have been updating my fixed point deserialization function which will serve as the base deserialization function for all the others. The signed and unsigned |
The question is what interface the |
The signature will probably end up like:
For the signed version, I don't know if we pass the sign through |
I was looking at the
from_str_radix
implementation and several things look wrong to me.-No option for signed
ApInts
-The input should be a
&str
not aString
for thefrom_str_radix
type.-How is the width of the
ApInt
determined? There should be an input for the width of theApInt
produced. Maybe the functions should have an extrawidth
in the name (and order the words in the order of the inputs). An example function signature could be:I am making a rough draft for it now.
As an aside, almost everything in this code snippet has something that I did not know Rust could do, I might use this technique for something.
The text was updated successfully, but these errors were encountered: