B
B
BonBon Slick2020-09-04 19:32:47
Algorithms
BonBon Slick, 2020-09-04 19:32:47

How to correctly calculate the number of steps per minute?

const minsFromHours = 0 < timer.hour ? +timer.hour * 60 : 0;
            const minsFromSecs = 0 < timer.sec ? +timer.sec / 60 : 0;
            // @todo - or simplify to seconds and then / 60?
            return +(minsFromHours + minsFromSecs + +timer.min).toFixed(2);

steps / timerMinutes
And it’s not clear to me what to divide by, steps into minutes or seconds? Or seconds per step?
Or minutes per step?
If there is a divisor of minutes, then what is the correct way to give seconds?
After all, 2 minutes and 30 seconds is !== 2.30, because 30 seconds is 50% of a minute, so it will be 2.5 minutes, not 2.30!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2020-09-04
@BonBonSlick

you have some twisted logic. normally.
of course divide the steps into minutes. but it will be average. and it all depends on the task.
and how to convert seconds to minutes refers to working with time, and not steps in particular and the title of the question in general.

D
dmshar, 2020-09-05
@dmshar

What is this, some kind of joke???
What is "kilometers per hour" or "steps per minute", what to divide by what - is taught in the fifth grade.
How many seconds are in a minute and how to convert minutes into seconds - they teach in the third grade.
If we read such a question from "Web Architect" - then either it's a joke, or - if it's not funny - then this Web Architect is still in elementary school.
And the people fell for it easily.
By the way, maybe it's just someone who decided to start a discussion about the need for mathematics in programming? :-)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question