          self.assertEqual(floatformat(0, 10), '0.0000000000')
          self.assertEqual(floatformat(0.000000000000000000015, 20), '0.00000000000000000002')
  
      def test_infinity(self):
          pos_inf = float(1e30000)
          neg_inf = float(-1e30000)
          self.assertEqual(floatformat(pos_inf), 'inf')
          self.assertEqual(floatformat(neg_inf), '-inf')
          self.assertEqual(floatformat(pos_inf / pos_inf), 'nan')
 
</s> remove     sign, digits, exponent = d.quantize(exp, ROUND_HALF_UP, Context(prec=prec)).as_tuple()
 </s> add     rounded_d = d.quantize(exp, ROUND_HALF_UP, Context(prec=prec))
    sign, digits, exponent = rounded_d.as_tuple() </s> remove     if sign:
 </s> add     if sign and rounded_d:
    def test_negative_zero_values(self):
        tests = [
            (-0.01, -1, '0.0'),
            (-0.001, 2, '0.00'),
            (-0.499, 0, '0'),
        ]
        for num, decimal_places, expected in tests:
            with self.subTest(num=num, decimal_places=decimal_places):
                self.assertEqual(floatformat(num, decimal_places), expected)

          self.assertEqual(floatformat(0, 10), '0.0000000000')
          self.assertEqual(floatformat(0.000000000000000000015, 20), '0.00000000000000000002')
  
    def test_negative_zero_values(self):
        tests = [
            (-0.01, -1, '0.0'),
            (-0.001, 2, '0.00'),
            (-0.499, 0, '0'),
        ]
        for num, decimal_places, expected in tests:
            with self.subTest(num=num, decimal_places=decimal_places):
                self.assertEqual(floatformat(num, decimal_places), expected)

      def test_infinity(self):
          pos_inf = float(1e30000)
          neg_inf = float(-1e30000)
          self.assertEqual(floatformat(pos_inf), 'inf')
          self.assertEqual(floatformat(neg_inf), '-inf')
          self.assertEqual(floatformat(pos_inf / pos_inf), 'nan')
keep keep add keep keep keep keep keep keep
 Fixed #30761 -- Prevented floatformat filter from returning a negative zero. 
tests/template_tests/filter_tests/test_floatformat.py