What would be the point of a division by 3 in your application? I just don't see how that would have a meaning in such an application type.
Anyway, what I suggest is using libraries that allow for aritrary precission numbers, something like these libraries and limiting them to a maximum of let's say 50 decimals in case that periodic numbers where needed, I don't think you'd need more than that.
If you somehow found a number where there's a trailing of nines you could write a function to round to the most near number so something like 4,5849999999...9, would be rounded to 4,585. The possibility of it not being that number in reality are so low that I doubt there would be more than a case in several billions of years, so it looks pretty safe to do it.