diff --git a/django/contrib/humanize/templatetags/humanize.py b/django/contrib/humanize/templatetags/humanize.py index c119395fde..fa644fd3a1 100644 --- a/django/contrib/humanize/templatetags/humanize.py +++ b/django/contrib/humanize/templatetags/humanize.py @@ -130,7 +130,7 @@ def intword(value): for exponent, converters in intword_converters: large_number = 10 ** exponent if value < large_number * 1000: - new_value = value / float(large_number) + new_value = value / large_number return _check_for_i18n(new_value, *converters(new_value)) return value diff --git a/django/core/paginator.py b/django/core/paginator.py index b07be513d3..6c9a2dac91 100644 --- a/django/core/paginator.py +++ b/django/core/paginator.py @@ -95,7 +95,7 @@ class Paginator: if self.count == 0 and not self.allow_empty_first_page: return 0 hits = max(1, self.count - self.orphans) - return int(ceil(hits / float(self.per_page))) + return ceil(hits / self.per_page) @property def page_range(self): diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index b0ab271723..b2e9b18351 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -1631,7 +1631,7 @@ class DurationField(Field): if value is None: return None # Discard any fractional microseconds due to floating point arithmetic. - return int(round(value.total_seconds() * 1000000)) + return round(value.total_seconds() * 1000000) def get_db_converters(self, connection): converters = [] diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index 5f56bb0d1f..3d97b0ceb0 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -486,7 +486,7 @@ class WidthRatioNode(Node): value = float(value) max_value = float(max_value) ratio = (value / max_value) * max_width - result = str(int(round(ratio))) + result = str(round(ratio)) except ZeroDivisionError: return '0' except (ValueError, TypeError, OverflowError): diff --git a/tests/delete/tests.py b/tests/delete/tests.py index 98467efb6a..b27181e963 100644 --- a/tests/delete/tests.py +++ b/tests/delete/tests.py @@ -325,7 +325,7 @@ class DeletionTests(TestCase): # Calculate the number of queries needed. batch_size = connection.ops.bulk_batch_size(['pk'], objs) # The related fetches are done in batches. - batches = int(ceil(float(len(objs)) / batch_size)) + batches = ceil(len(objs) / batch_size) # One query for Avatar.objects.all() and then one related fast delete for # each batch. fetches_to_mem = 1 + batches