3 ms·
A stronger argument for storing 'percentages' as [0.0,1.0] can be made, the precision involved is seldom a limiting factor. It has to do with why I put percent
by samatman 2y ago
A stronger argument for storing 'percentages' as [0.0,1.0] can be made, the precision involved is seldom a limiting factor.
It has to do with why I put percentage in scare quotes. A percentage is a certain way of writing a fraction, one which is more convenient in some cases for humans to work with. Generally, whatever you're doing with that number is more effectively done with the range [0.0,1.0], other than perhaps printing it, which is trivial. Carrying it around inside the calculation imposes a conceptual burden which is of no use in implementing whatever problem one is trying to solve.
It's true that you avoid a strange discontinuity of gradient at 1%, but it hardly matters, the real driving force here is that any practical use of 60% is realized using 0.6, so if you're going to divide your 'percentage' by 100 in order to do N * M%, just do it when you read in the number and get it out of the way.