-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Use microgram (μg) resolution mass for food vitamins #68988
Conversation
I recommend to add |
This is a singular, obscure use case that is establishing a ratio, changing the base mass for everything in the game goes too far. All you need to do here is refrain from changing the default mass unit and explicitly construct a mass type with the desired unit inside the vitamin deserialization code and in the associated data structures. |
A nitpick: What you're actually talking about is "resolution", not "precision". Any resolution in the world can't save you from loss of precision from a sequence of unfortunate or poorly chosen computational steps, such as division between two very close values. |
a89552d
to
dc903ef
Compare
dc903ef
to
63e083c
Compare
It appears you modified a |
63e083c
to
fbbc81f
Compare
I made a little bit of a mess, but it should be cleaned up now. I've updated to follow Kevin's suggestion. |
Looks like one of the builds has errors from this?
|
Yes. This isn't ready for merge yet, I was going to wait until #68986 is merged and fix it then. |
Vitamins are often present in very small quantities, so to specify vitamins by weight, more precision that 1mg is required for mass. Introduce and use a special higher-precision units type for vitamin mass, and plug it into the code to all the vitamin mass parsing code. 'μg', 'ug', 'mcg' are supported when representing mass strings in JSON.
fbbc81f
to
2f9bc68
Compare
Summary
SUMMARY: None
Built on #68986. Please do not merge until that is merged.
Purpose of change
#68986
Vitamins are often present in very small quantities, so to specify vitamins by weight, more precision that 1mg is required for mass.
Describe the solution
Introduce and use a special higher-precision units type for vitamin mass, and plug it into the code to all the vitamin mass parsing code.
μg
,ug
,mcg
are supported when representing mass strings in JSON.Testing
Vitamins on protein drink, shake, and fortified shake are loaded correctly.
Additional context
Thanks for the assistance in coming to this solution.