It's kinda surprising given the hype about computers that they really are not very good at math. Any middle-schooler knows that:
( 1 / 3 * 3 ) = ( 1 * 3 / 3 ) = 1
but it's a very rare computer language that gets that right. You have to be very careful with any floating arithmetic, and even more careful with decimal money. Use COBOL for that
When comparing floats you might want to make a comparison method with a fuzz factor: if ( abs( a - b ) < fuzz factor ) return true.