@Artellet What is the goal of this function? You could multiply it by 100, Math.floor it, then divide by 100 again.

Why not use int or long for everything and when you want to show the number to the player cast to double and divide by 100 (well, depends on how many digits after the decimal point you want)?

... eh, I guess I need to explain in more detail. No, I didn't misunderstand the thread. If you keep all of the money in an integer - let's say in cents - then all of the operations you do on them, including withdrawal, are also done on integers, completely erasing the problem you have. Cents are 1/100 of a dollar, so you don't need any fractions smaller than that when operating on money. If you multiply that by a 100, it leaves you with only integers. This system obviously supports any currency, as long as you decide on how many digits after the decimal point in the main currency you need.

@Artellet Exactly. Which is why you want to use it and then cast and divide by 100, so you only get a number with two decimal places.

*snip* Final edit: Solved thanks to @sebcio98 & @Zombie_Striker. Spoonfeed: Code: yourDouble = ((double) ((int) (yourDouble * 100))) / 100;