abian added a comment.

The hairy part is the conversion, and I suppose that's already solved. When we have all the data in the same unit, we can use these formulas:

  • mindiff = max{0, d1-d2-u2, d2-d1-u1} and
  • maxdiff = max{u1+d1-d2, u2+d2-d1},

where u1 and u2 are the units of precision for d1 and d2, respectively.

Translating the first example in the description, but using years again for simplicity (we should use seconds), if we have d1 = 1990 with a precision u1 = 1 (a year) and d2 = 20th century = 1901 with a precision u2 = 100 (a century), then

  • mindiff = max{0, d1-d2-u2, d2-d1-u1} = max{0, 1990-1901-100, 1901-1990-1} = max{0, -11, -90} = 0 and
  • maxdiff = max{u1+d1-d2, u2+d2-d1} = max{1+1990-1901, 100+1901-1990} = max{90, 11} = 90.

If mindiff > P2312 or P2313 > maxdiff, then there is a violation.

The case of the quantities is almost identical. We have n1 = 12±1, so d1 = 11 and u1 = 2*1; and we have n2 = 55±5, so d2 = 50 and u2 = 2*5:

  • mindiff = max{0, d1-d2-u2, d2-d1-u1} = max{0, 11-50-2*5, 50-11-2*1} = max{0, -49, 37} = 37 and
  • maxdiff = max{u1+d1-d2, u2+d2-d1} = max{2*1+11-50, 2*5+50-11} = max{-37, 49} = 49.

If mindiff > P2312 or P2313 > maxdiff, then there is a violation.


TASK DETAIL
https://phabricator.wikimedia.org/T195226

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: abian
Cc: Lucas_Werkmeister_WMDE, abian, Aklapper, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, Agabi10, Wikidata-bugs, aude, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to