      prec = abs(p) + units + 1
  
      # Avoid conversion to scientific notation by accessing `sign`, `digits`,
      # and `exponent` from Decimal.as_tuple() directly.
      sign, digits, exponent = d.quantize(exp, ROUND_HALF_UP, Context(prec=prec)).as_tuple()
      digits = [str(digit) for digit in reversed(digits)]
      while len(digits) <= abs(exponent):
          digits.append('0')
      digits.insert(-exponent, '.')
      if sign:
 
</s> remove     if sign:
 </s> add     if sign and rounded_d:
    rounded_d = d.quantize(exp, ROUND_HALF_UP, Context(prec=prec))
    sign, digits, exponent = rounded_d.as_tuple()
      prec = abs(p) + units + 1
  
      # Avoid conversion to scientific notation by accessing `sign`, `digits`,
      # and `exponent` from Decimal.as_tuple() directly.
    rounded_d = d.quantize(exp, ROUND_HALF_UP, Context(prec=prec))
    sign, digits, exponent = rounded_d.as_tuple()
      digits = [str(digit) for digit in reversed(digits)]
      while len(digits) <= abs(exponent):
          digits.append('0')
      digits.insert(-exponent, '.')
      if sign:
keep keep keep keep replace keep keep keep keep keep
 Fixed #30761 -- Prevented floatformat filter from returning a negative zero. 
django/template/defaultfilters.py