The compilation issue wouldn't be there, as you said, if the return value is cast back to uint8_t. But the point, I am making here is that you're giving away the precision that you wanted in the first place by typecasting to double and then returning it as uint8_t. By typecasting 8 bytes to 1 byte, when precision is important doesn't make sense.
As I mentioned before, I have fixed the compilation issue here to get my build going. If you really think that converting that double back to uint8_t is the right thing to do, then you can patch the code again.