R
R
Russian Cheese2019-05-04 18:00:51
Algorithms
Russian Cheese, 2019-05-04 18:00:51

How to invert values?

I have a variable 0.0 < x < 100.0 and there is a cycle in which x is a delay, but I want the delay to be 100 instead of 0 at x=0, respectively, at x=100 the delay should be 0.
Tell me how to do this, maybe everything is elementary and I'm just dumb, or I'm asking for something really complicated.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
D3lphi, 2019-05-04
@vadimkacool

const int MAX_LATENCY = 100;
int current_latency = MAX_LATENCY - x;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question