4 ms·
(((price - 100) / abs(price - 100)) * 25 + 75) / 10 Here you go, simple integer math, no programming necessary :) That said, this isn't optimisation, multiplic
by Evgeniuz 13y ago
(((price - 100) / abs(price - 100)) * 25 + 75) / 10
Here you go, simple integer math, no programming necessary :)
That said, this isn't optimisation, multiplication and division aren't intrinsically better than branching.