🛠️ToolsShed

Calculateur d'Inflation

Calculez la valeur réelle de l'argent dans le temps en fonction du taux d'inflation.

Questions Fréquentes

Implémentation du Code

def adjust_for_inflation(amount, annual_rate, years, to_future=True):
    """
    Adjust an amount for inflation.
    to_future=True: present -> future value
    to_future=False: future -> present (real) value
    """
    if to_future:
        return round(amount * ((1 + annual_rate) ** years), 2)
    else:
        return round(amount / ((1 + annual_rate) ** years), 2)

def years_to_double(annual_rate):
    """Rule of 70: years for prices to double."""
    return round(70 / (annual_rate * 100), 1)

def real_return(nominal_return, inflation_rate):
    """Fisher equation: real return approximation."""
    return round(((1 + nominal_return) / (1 + inflation_rate) - 1) * 100, 4)

# Examples
print(adjust_for_inflation(1000, 0.03, 10))          # 1343.92 (future)
print(adjust_for_inflation(1343.92, 0.03, 10, False)) # 1000.0  (real)
print(years_to_double(0.035))                         # 20.0 years
print(real_return(0.07, 0.03))                        # ~3.88%

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.