-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.calc
75 lines (59 loc) · 1.45 KB
/
example.calc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# With calc notebook you can do simple calculations and see the result on the left
# To copy the result simply click it
5 * 3
# Or complex ones
log(14^(sqrt(55)*3)) + 2^(3/55)
# You can type numbers in a few different ways:
5,32
5.000.000
32%
# You can also save a result and reuse it later
discount: 20%
price: 50
price * (1 - discount)
# The order doesn't really matter though: you can use values defined later on
deposited: 500
balance: round(deposited * (1+interest_rate))
balance_after_5_years: round(deposited * (1+interest_rate)^5)
interest_rate: 5%
# Try changing the interest rate, the balance will be updated automatically
balance
# You can specify the unit for any line by putting it in brackets
item_price: 5 [usd]
amount: 7
total: item_price * amount
# Or in a slightly more complex example
distance: 6 [km]
time: 3 [min]
speed: distance / time
# km/min is a weird unit for speed, we can change it by specifying the unit we want:
distance / time [km/hour]
# You can leverage this feature to quickly convert units
(72 [km/hour]) [m/s]
# Some of the supported units
(15 [celsius]) [fahrenheit]
(10 [inch]) [cm]
(1 [month]) [hours]
(65 [kg]) [pounds]
(1 [atm]) [mmHg]
sin(90 [deg])
sin(pi [rad])
# You can even use made up units:
heal: 0,5 [hearts/apples]
(5 [apples]) * heal
# A full list of the mathematical functions supported
5 + 5
4 - 2
9 / 6
-8 * 2
2 ^ 3
sqrt(16)
log(100)
ln(e^5)
sin(pi/2)
cos(pi/2)
tan(pi/4)
abs(-3)
round(3,6)
ceil(3,1)
floor(3,9)