Thread (40 messages) flat view 40 messages, 4 authors, 2016-08-15

Re: [PATCH 8/8] diff: improve positioning of add/delete blocks in diffs

From: Stefan Beller <hidden>
Date: 2016-08-03 22:52:02

On Wed, Aug 3, 2016 at 3:41 PM, Michael Haggerty [off-list ref] wrote:
On 08/04/2016 12:30 AM, Stefan Beller wrote:
quoted
On Wed, Aug 3, 2016 at 3:00 PM, Michael Haggerty [off-list ref] wrote:
quoted
+        return 10 * score - bonus;
Would it make sense to define-ify the 10 as well
as this is the only hardcoded number in the
scoring function?
I started answering this question by explaining why it is not important
to *optimize* the number 10 (namely because scores are only ever
compared against other scores, so an overall scaling factor makes no
difference). The factor 10 only has to be large enough to provide enough
dynamic range for the other (adjustable) parameters.
But it only scales the score, not the bonus. So another way to write it
would be

    score - bonus/10;

assuming the values of score and bonus are large enough.

In some prior conversation you said you take the indent and add an epsilon
for some special conditions to make one indent better than the other.

Epsilons are usually very small compared to the rest of the equation,
but if I look at the boni definitions ranging from -63..50 they are scaled up
so much that the bonus may become larger than '1' unit of 'score', i.e.
it is not an epsilon any more. Or to put it another way:
If we were to s/10/100/ the results would be worse.

Rather the 10 describes the ratio of "advanced magic" to pure indentation
based scoring in my understanding.
But I think you are asking a simpler question: should we give this
constant a name rather than hardcoding it? I don't see a strong reason
for or against, so I'll give it a name in the next version, as you suggest.
Thanks,
Stefan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help