import re
def num(s):
    if s is None: return None
    t=str(s).lower().replace("—","-").replace("–","-").replace(",","")
    neg = t.strip().startswith("(") or "-" in t
    m=re.search(r"\d+(?:\.\d+)?", t)
    if not m: return None
    v=float(m.group(0)); return -v if neg else v
def same_number(a, b):
    """True when a and b are the same figure, allowing a thousands/millions scale difference and rounding."""
    x,y=num(a),num(b)
    if x is None or y is None: return (a or "").strip().lower()==(b or "").strip().lower()
    if x==y: return True
    if x==0 or y==0: return False
    for k in (1,1e3,1e6,1e-3,1e-6):
        if abs(x*k - y) <= max(abs(y)*0.002, 0.05): return True
    return False
