-
Notifications
You must be signed in to change notification settings - Fork 13
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
Support for floats? #45
Comments
Likely because no one had needed them in a use case up until now -- AFAIK, the addition of new field types has largely been on an as-needed basis. Is there a particular protocol you have in mind that requires floats to be encoded as bytes, as opposed to a text-based implementation? |
Fair enough, I'm not working with a particular protocol but rather with parsing and repacking some uncommon 3D graphic model files (as you can imagine a lot of vector fields containing floats). Originally I used the struct library which had float support but suitcase is vastly more eloquent... I can't go back :P I'm not sure what you mean by a text-based implementation, can you please elaborate? If its possible to cover 16/32/64 bit floats I'd be really grateful. |
I would accept a PR adding floating point support. You should be able to add basic support easily by using the struct format strings similar to the existing ones like https://github.com/digidotcom/python-suitcase/blob/master/suitcase/fields.py#L1055 |
Sorry to reopen this again but @posborne its seems that the way this package unpacks data can't be done for floats. I'm getting the following error:
The unpack definition would require change to allow floats https://github.com/digidotcom/python-suitcase/blob/master/suitcase/fields.py#L998. Any suggestions? |
I've just come across this library and after checking out the documentation at https://digidotcom.github.io/python-suitcase/latest/api.html I was wondering why there isn't support for floats?
The text was updated successfully, but these errors were encountered: