You are suffering from a combination of issues here, first is the choice by SFDC to use a floating-point representation for currency fields (this is covered in the
A number that includes a decimal point. Decimal is an arbitrary precision number. Currency fields are automatically assigned the type Decimal.
The second issue is the floating point precision (or rather, the lack of). In short, 1/3 cannot be exactly represented by an IEEE-754 floating-point number.
At some point when dealing with currency in floating-point format you need to make the decision to round (preferably after all of your calculations, using
setScale in SFDC) and then deal with the result of that rounding. For example, if you use
setScale on your final result to set the precision to decimal places you will get the correct result.
Decimal d = 175000.0000000008;
Here is a Stack Overflow answer which gives you the short version of why floats and double are not suitable for use in currency calculations, Oracle also host a fantastic journal article by David Goldberg on their site which goes into great detail about the issues with floating point numbers: