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

Incorrect calculation of weight #67

Open
firedev opened this issue Sep 14, 2018 · 2 comments
Open

Incorrect calculation of weight #67

firedev opened this issue Sep 14, 2018 · 2 comments

Comments

@firedev
Copy link

firedev commented Sep 14, 2018

I always had the feeling that jumps between weights are irregular. And now I can put a finger on it. After deloading I have noticed that AMRAP set for TM 295 and TM 300 is the same - 285. But this is incorrect:

TM 295 * .95 = 280.25 — Should be AMRAP 280
TM 300 * .95 = 285 — Correct

I came to the suggestion that you are using ceil instead of floor when rounding. There is also a related issue about rounding to 5lbs #37

Here is my attempt at fixing it, the calculations are done in JavaScript so you can paste the code in your browser console:

TM AMRAP 2.5lbs
295 280.25 280
300 285 285

Full table from TM 225 to TM 315

TM 2.5lbs 5lbs AMRAP 2.5lbs 5lbs
255 255 255 242.25 240 235
260 260 255 247 245 245
265 265 265 251.75 250 245
270 270 265 256.5 255 255
275 275 275 261.25 260 255
280 280 275 266 265 265
285 285 285 270.75 270 265
290 290 285 275.5 275 275
295 295 295 280.25 280 275
300 300 295 285 285 285
305 305 305 289.75 285 285
310 310 305 294.5 290 285
315 315 315 299.25 295 295
const weights = Array(13).fill().map((_, x) => 255 + x * 5)
const bar = 45

const getRounding = to => (weight) => {
  const loaded = to * 2
  const rest = weight - bar
  const rate = Math.floor(rest / loaded)
  return loaded * rate + bar
}

const rounding2_5 = getRounding(2.5)
const rounding5_0 = getRounding(5)


const table = weights.map(weight => {
  const amrap = weight * 0.95
  return ({
    weight, 
    weightTwoFive: rounding2_5(weight), 
    wightFive: rounding5_0(weight),
    amrap,
    amrapTwoFive: rounding2_5(amrap), 
    amrapFive: rounding5_0(amrap),
  })
})

console.table(table, Object.keys(table[0]))
@JonnyBeeGod
Copy link
Owner

What is your smallest weight plate? The app takes the smallest weight plate into account in order to calculate weights which are possible to load with a 20 kg bar and with plates as low as your smallest plate.

@firedev
Copy link
Author

firedev commented Sep 15, 2018

2.5lbs (Recommended)

My point is that it should not round 95% of 295 to 285. It should be either 280 for 2.5lbs or 275 for 5lbs plates.

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