I saw you post these example inputs/outputs in discord:
2 - 4
50%
4 - 4
100%
6 - 4
50%
This is a bit more complicated. I think you made a mistake here - the last one should be 66%. I can’t think of a formula that would return 50% in that case but also get smaller as the first number got larger. Assuming I understand the formula you were trying to demonstrate, the function would look like this, where “a” is the first number and “b” is the second (and the base):
return a.sub(b).abs().div(a.max(b))