---
title: "General / Cross-Stack Mistakes"
tags: [general, mistakes]
updated: 2026-05-18
---

# General / Cross-Stack — Mistakes to Avoid

Running list. Newest first. Auto-populated from session flush.

---

<!-- mistakes appended below by compile.py -->

## 2026-05-18 — float-percent-formatting

**Mistake:** Output `"1.10%"` instead of `"1.1%"` for percentage values like `1.1`.

**Symptom:** Formatted percentage strings showed unnecessary trailing zeros (e.g. `"3.30%"`, `"6.60%"`) even for values that are exact to one decimal place.

**Root cause:** `1.1 * 100 = 110.00000000000001` in binary float; `% 1 == 0` returns `False`; the "whole number" branch was never taken, falling through to `:.2f` formatting.

**Fix:** Format to fixed dp first, then `rstrip("0").rstrip(".")`:
```python
f"{value * 100:.10f}".rstrip("0").rstrip(".")
```

**See also:** [[wiki/concepts/python-float-formatting-comparison]]
