Skip to content
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

measurement_from_string for single precision #5

Closed
JensMunkHansen opened this issue Dec 11, 2019 · 3 comments
Closed

measurement_from_string for single precision #5

JensMunkHansen opened this issue Dec 11, 2019 · 3 comments

Comments

@JensMunkHansen
Copy link

I see that measurement_from_string produces a units::precision_measurement. Would it be possible to add one for single precision also.

Would it make sense to rename precision_measurement to precise_measurement in line of precise_unit?

@phlptp
Copy link
Collaborator

phlptp commented Dec 11, 2019

That makes sense for the precise_measurement for consistency, I will make that change soon. Thanks!

As for getting a measurement from a string, There is unit_cast_from_string to a get a regular unit from the string, but I didn't have an equivalent for the measurement. Not entirely sure what the function should be named? I don't really want to template it, and I want the simplest one to actually be the higher precision.

Any Ideas?

@phlptp
Copy link
Collaborator

phlptp commented Dec 14, 2019

I changed the name of precision_measurement to precise_measurement so it is consistent throughout the library. Thanks for that suggestion!

I also added measurement_cast_from_string that returns a measurement instead of precise_measurement and added a measurement_cast function. This is consistent with what was in place for units. I can't say I totally like those names but I think the simpler string conversion functions should return the more precise versions of units any measurements even if the names aren't completely consistent. just to be clear that the other can lose information. So I am not entirely sure what to name the versions that return the less precise units/measurement.

Any thoughts?

@phlptp phlptp closed this as completed Jan 20, 2020
@JensMunkHansen
Copy link
Author

JensMunkHansen commented Jan 21, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants