Currently, the handling of periodic ranges in GetBestMatchAssestFrom is implemented as
| real32 D0 = AbsoluteValue(A - B);
real32 D1 = AbsoluteValue((A - Assets->TagRange[Tag->ID]*SignOf(A)) - B);
real32 Difference = Minimum(D0, D1);
|
An alternative implementation might be
| real32 Difference = AbsoluteValue(A - B);
if (Difference > TagRange[Tag->ID])
Difference = 2 * TagRange[Tag->ID] - Difference;
|
I don't think the alternative implementation is necessarily any better. Although, at least for me, it is easier to visualize what is going on with the math.
Thanks!