Since the "authoritative" source of information is in cents ... which is wise ... I think that I would first convert the string to a floating point number, then multiply by 100, then simply truncate to an integer. If the difference is ±1 cent, accept the answer. Part of the problem here is that you have no way to know – or of course to control – exactly what the other side is doing, what libraries they might be using to talk to you, and so on. I predict that most of the time you actually will get an exact match. When you do not, rounding-error can throw the result off by no more than one cent. "The bane of accountants everywhere."