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

Don't use divison on the unit converter. #1006

Closed
nilsschmidt1337 opened this issue Nov 26, 2023 · 1 comment
Closed

Don't use divison on the unit converter. #1006

nilsschmidt1337 opened this issue Nov 26, 2023 · 1 comment
Assignees
Milestone

Comments

@nilsschmidt1337
Copy link
Owner

nilsschmidt1337 commented Nov 26, 2023

This is a wish from J.C. Tchang (#978).

Instead of the three factors, I need more fators to avoid the divison:

I18n.UNITS_FACTOR_PRIMARY
I18n.UNITS_FACTOR_SECONDARY
I18n.UNITS_FACTOR_TERTIARY

This is required:

I18n.UNITS_FACTOR_INCH_TO_LDU = 64 ldu
I18n.UNITS_FACTOR_INCH_TO_MM = 25.4 mm

I18n.UNITS_FACTOR_LDU_TO_INCH = 0.015625 in
I18n.UNITS_FACTOR_LDU_TO_MM = 0.4 mm

I18n.UNITS_FACTOR_MM_TO_INCH ~ 0.03937007874015748031496062992126 in (more than enough precision)
I18n.UNITS_FACTOR_MM_TO_LDU = 2.5 ldu
@nilsschmidt1337
Copy link
Owner Author

Closed with commit fbcf3c5.

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

No branches or pull requests

1 participant