Created
August 6, 2021 06:01
-
-
Save benprew/7ae8fae988b04ed6bcae1c66287c2944 to your computer and use it in GitHub Desktop.
bodyfat calculator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
height=$1 | |
neck=$2 | |
abdomen=$3 | |
if [[ -z $height || -z $neck || -z $abdomen ]]; then | |
echo "$0 - calculate your bodyfat using the US Navy method" | |
echo "Usage: $0 <height> <neck> <abdomen>" | |
echo " height - height (in inches)" | |
echo " neck - neck diameter (in inches, just above adam's apple)" | |
echo " waist - waist diameter (in inches, narrowest point)" | |
exit 1 | |
fi | |
bodyfat=$(echo "86.010 * (l($abdomen - $neck)/l(10)) - 70.041 * (l($height)/l(10)) + 36.76" | bc -l) | |
printf "bodyfat: %0.0f%%" $bodyfat |
Hmm... Interesting, do they take the average of the three measurements or
the average body fat calculation that results from the 3 sets of
measurements?
Ie they only calculate your bf once vs calculating your bf 3 times.
…On Thu, Aug 5, 2021, 11:53 PM prewdigy ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
I am assuming they measure your neck and abdomen more than once to get an
average. why not have it do those calculations as well for you. I think
they round to the nearest 1/4" and use three measurements. or at least that
is how the army does it.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/7ae8fae988b04ed6bcae1c66287c2944#gistcomment-3848434>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAJHV6YFR35TDCM624LNZDT3OBGHANCNFSM5BVJYPRQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
.
they take the average of the set of measurements then use that to calculate it. and they measure your neck, then you stomach, then you neck and so forth.
also considering how much you normally work out. i wouldn't put a lot of faith in it for giving you a decent level of exactness.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am assuming they measure your neck and abdomen more than once to get an average. why not have it do those calculations as well for you. I think they round to the nearest 1/4" and use three measurements. or at least that is how the army does it.