Measure the distance with DWM1000 DS-TWR

Hi,

Reference a github lps-node-firmware, print the distance value is negative number, for example, -105mm,-136mm. we see that you measure the distance with the DS-TWR method follow as:
Tag send poll -> Anchor receive poll, then answer -> Tag reveive answer, then send final -> Anchor reveive final, then send report(include pressure and anchor timestamp information) -> Tag receive report, then calculate the distance.
I see the algorithm:

tprop_ctn = ((tround1*tround2) - (treply1*treply2)) / (tround1 + tround2 + treply1 + treply2);

Two issue:
(1)I don’t konw how to get the formula.
(2)From the dw1000(http://www.kynix.com/Parts/2705023/DWM1000.html)-user-manual, we find the formula

But we should more easily understand the 12.3.3 Using symmetric reply times formula:

Hello, I have the exact same issue. I cannot understand how to get this formula.
Can you explain the mathematics behind this?
Thank you in advance.

EDIT: Ok, I’ve found the explanation here:
https://forum.bitcraze.io/viewtopic.php?t=1944#p9959