fixed floor function for negative values