draftply Download

Inflation Calculator

← All samples

inflation-calculator.dplyEditor
1---
2app_version: 0.1.0
3precision: 2
4form_title: Inflation Calculator
5form_description: See how inflation affects your money. Enter amount, inflation rate and years to see future value and purchasing power loss.
6form_inputs: Amount|amount{€}, Inflation rate|inflation{%}, Years|years
7form_outputs: Future nominal value|future_value, Purchasing power|purchasing_power, Loss|lost, Annual loss|annual_loss
8---
9# Inflation Calculator
10// How much will inflation reduce the value of your money?
11
12# Parameters
13amount = 10000 € // current amount of money
14inflation = 2.5 % // expected annual inflation rate
15years = 10 // time period (years)
16
17# Calculations
18// Future nominal value (same number, but worth less)
19future_value = amount
20
21// Future value adjusted for inflation
22// Real value = nominal / (1 + inflation)^years
23purchasing_power = amount / (1 + inflation)^years
24
25// Purchasing power loss
26lost = amount - purchasing_power
27lost_percent = (lost / amount) * 100
28
29// Annual average loss of purchasing power
30annual_loss = (1 - 1 / (1 + inflation)) * 100
31
32// What will X in the future cost in today's money?
33// If something costs 100 in the future, how much is that in today's euros?
34future_cost = 100 €
35todays_equivalent = future_cost / (1 + inflation)^years
36
37// Rule of 72 for inflation: years until prices double
38years_to_double_prices = 72 / (inflation * 100)
39
40// Equivalent: how much do you need in the future to have same purchasing power?
41equivalent_future = amount * (1 + inflation)^years
42
43// Monthly inflation rate — linear approximation (annual / 12), not the
44// compounding (1 + inflation)^(1/12) - 1. Off by well under 0.01 percentage
45// points at typical rates, so close enough for a quick estimate.
46monthly_inflation = inflation / 12
47
48// Purchasing power per year
49purchasing_power_year(n) = amount / (1 + inflation)^n
50
51# Results
52"Current amount": amount
53"Inflation rate (%)": inflation * 100
54"Time period": years
55
56"Future nominal value": future_value
57"Future purchasing power": purchasing_power
58"Purchasing power lost": lost
59"Loss percentage": lost_percent
60
61"Annual average loss": annual_loss
62"Years until prices double": years_to_double_prices
63
64To keep today's purchasing power in {years} years you need {equivalent_future}.
65
66Something costing {future_cost} in {years} years is {todays_equivalent} today.
67
68// Purchasing power over time
69plot(purchasing_power_year(x), 0..years, "Purchasing power", "Years", "€", "Real value of {amount} over time")
70