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

Add kcal and Cal #19

Open
ethanc8 opened this issue Aug 8, 2024 · 6 comments
Open

Add kcal and Cal #19

ethanc8 opened this issue Aug 8, 2024 · 6 comments

Comments

@ethanc8
Copy link

ethanc8 commented Aug 8, 2024

These are common units of dietary energy. 1 kcal = 1 Cal = 1 Calorie = 1 kilogram-calorie = 1000 cal = 1000 gram-calories.

@alexbarry
Copy link
Owner

Thanks! I'll clear this up tonight or this weekend. I did add "cal" to mean 4.184 J, but I can easily add most of the others.

I'll add "kcal" to mean "1000 cal". Let me know if it's worth adding other SI prefixes for 10 to the power of 2, 6, etc.
I'll also add "Cal" and "Calorie" (and probably "Calories") to mean the same as "kcal".

I'm not sure how easy it will be to handle dashes or spaces in unit definitions, though. Right now if you say 1 kg-cal it would interpret it as 1 kg minus the variable cal.

For fl oz (fluid ounces) and mm Hg I simply omitted the space, and it seems legible enough. I think I could add a period as a separator, do you think that would work well? You would have to type 1 kilogram.calorie or 1 gram.calories. And if you select the unit from the popup, you wouldn't really notice much unless you're looking at the plaintext input. (Context: I don't have any telemetry so I have no idea how people tend to use the app, I'm happy to hear feedback on whether I should prioritize nice plaintext input, or the popup and GUI).

Also thanks a lot for reporting this! It's helpful to know how people want to use this app, I studied electrical engineering years ago, so I'm lacking knowledge in a lot of other units/etc.

@ethanc8
Copy link
Author

ethanc8 commented Aug 8, 2024

Well, for kilogram-calorie and gram-calorie, people really don't ever spell them out in full. I think kcal, Cal, calorie, Calorie, and kilocalorie will be fine.

@ethanc8
Copy link
Author

ethanc8 commented Aug 8, 2024

Also, these units are used pretty much only in the dietary sense. Most other fields will either use SI units (joules etc), Imperial units (BTU etc), or eV (electron-volts).

@alexbarry
Copy link
Owner

Got it, thanks! I'll add those soon. Do you use the web version or the Android app on F-Droid or Google Play? I'll eventually update them all, but I can prioritize whichever one you use first. The web app will update within minutes of me publishing the change, but F-Droid and Google Play may take a week or so and involve a bit of site specific effort.

@ethanc8
Copy link
Author

ethanc8 commented Aug 8, 2024

I use F-Droid.

@alexbarry
Copy link
Owner

Hi @ethanc8, I added these units in a pull request but haven't yet merged it. You could try the experimental version here if you want: https://alexbarry.net/dev/calc/2025-01-12/ (Code is here)

Let me know if you have any feedback or find any bugs! I was planning on waiting a week or two to test it before pushing it to the main github pages and F-Droid versions. My unit tests pass and I tried a few calculations myself, but sometimes unexpected problems could happen, so I didn't want to rush to push the changes out. Adding the new units was a small change, but I pushed in some other updates too that could have broken something.

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