If you allow float fraction, you need to modify take_fraction to round quantity, so quantity is always a integer