That code is basically to verify if your roll result is provably fair.You don't really copy paste the code anywhere but you use that algorithm to verify if the result of your roll is exactly the same after you apply the actual txid and secret open hash.You don't need a lot of math to do so,Internet does everything for you.
NlNiCo has nicely explained how to check and verify the result also he has provided all the links such as Sha512 converter/modulo finder/hex to decimal ,all you literally have to do is just copy paste your tx along with the server hash from the list below the code on the website.
Hope this helps.If its too much too understand ,let me know I will break it down for you.
https://dicesites.com/provably-fairMaybe you should offer a bounty for this. You might have better luck finding someonenthat can assist you that way.
YoShitters and their opinions...I wonder if having a YoShit signature automatically affects your brain.