aboutsummaryrefslogtreecommitdiff
path: root/README.org
diff options
context:
space:
mode:
authorLibravatar Comrade Martin Miroslavovich Michalec <martin@michalec.dev>2023-11-26 21:34:11 +0000
committerLibravatar Martin Michalec <martin@michalec.dev>2026-11-07 02:13:38 +0000
commit252df6c74c7be9b82aa89cdb4972f91c87b06184 (patch)
tree988497c67eb3d8d8789aa9bdea47bafd300e25b2 /README.org
downloadcoursework-252df6c74c7be9b82aa89cdb4972f91c87b06184.tar.gz
publishHEADmaster
Diffstat (limited to 'README.org')
-rw-r--r--README.org207
1 files changed, 207 insertions, 0 deletions
diff --git a/README.org b/README.org
new file mode 100644
index 0000000..a38a91a
--- /dev/null
+++ b/README.org
@@ -0,0 +1,207 @@
1#+title: RPN calculator for multi-precision finite arithmetic
2
3* Task[fn:1]
4Create a calculator for multi-precision finite arithmetic <Z_i; ​+, *>
5(8 digits) for four operations (​+, -, *, ÷) based on single-precision
6finite arithmetic, where the "​+​1" rule is defined and the properties
7of commutativity (​+, *), associativity (​+, *), and distributivity of *
8over + are satisfied; an additive identity "a" and a multiplicative
9identity "b" are defined; and the following property holds: for (∀x)
10x*a=a. Additionally, you can implement exponentiation, as well as the
11search for GCD and LCM for two numbers.
12
13#+caption: The "+1" rule
14#+attr_html: :style margin: auto;
15| x | = | a | b | c | d | e | f | g | h |
16| x + b | = | b | d | h | c | f | a | e | g |
17
18* Documentation
19The exported report can be found at [[https://git.michalec.dev/uni/term-03/discrete-math/coursework/report.pdf][this link]].
20
21* Showcase
22
23#+begin_src text
24> jsadh
25[-] ERROR: input doesn't match regexp `^\s*([+-][a-h]{1,8}|nop|dup|del|clr|swp|neg|add|mul|sub|div|mod|inc|dec|pow|gcd|lcm)\s*$'
26> nop
27
28> +f
29 f
30
31>
32 f
33 f
34
35> dup
36 f
37 f
38 f
39
40> add
41 f
42 be
43
44> sub
45 -f
46
47> neg
48 f
49
50> -a
51 f
52 a
53
54> div
55[*] INFO: division by zero
56[*] INFO: operation resulted in empty set
57
58> +a
59 a
60
61>
62 a
63 a
64
65> div
66[*] INFO: dividing zero by zero
67[*] INFO: operation result is a range: [-ffffffff; ffffffff]
68
69> +ffffffff
70 ffffffff
71
72>
73 ffffffff
74 ffffffff
75
76> mul
77[-] ERROR: operation has overflown
78
79> +ghf
80 ghf
81
82> -fe
83 ghf
84 -fe
85
86> mod
87 eb
88
89> +ghf
90 eb
91 ghf
92
93> -fe
94 eb
95 ghf
96 -fe
97
98> div
99 eb
100 -g
101
102> -fe
103 eb
104 -g
105 -fe
106
107> mul
108 eb
109 hee
110
111> add
112 ghf
113
114> inc
115 gga
116
117>
118 ggb
119
120>
121 ggd
122
123>
124 ggc
125
126> dec
127 ggd
128
129>
130 ggb
131
132>
133 gga
134
135> del
136
137>
138[*] INFO: stack is already empty
139
140> clr
141[*] INFO: stack is already empty
142
143> +d
144 d
145
146> +h
147 d
148 h
149
150> pow
151 da
152
153> del
154
155> +e
156 e
157
158> +h
159 e
160 h
161
162> gcd
163 d
164
165> +c
166 d
167 c
168
169> lcm
170 e
171
172> +f
173 e
174 f
175
176> swp
177 f
178 e
179
180> clr
181
182> ^Cinterrupt
183#+end_src
184
185* Unlicense
186#+include: UNLICENSE verse
187
188* Footnotes
189
190[fn:1] Original text:
191#+html: <i>
192#+begin_quote
193Сформировать калькулятор «большой» конечной арифметики <Z_i; +, *> (8
194разрядов) для четырех действий (​+, -, *, ÷)= на основе «малой»
195конечной арифметики, где задано правило «+1» и выполняются свойства
196коммутативности (​+, *), ассоциативности (​+, *), дистрибутивности *
197относительно +, заданы аддитивная единица «a» и мультипликативная
198единица «b», а также выполняется свойство: для (∀х) х*a=a.
199Дополнительно можно реализовать возведение в степень, поиск НОД и НОК
200для двух чисел.
201
202#+caption: Правило «+1»:
203#+attr_html: :style margin: auto;
204| x | = | a | b | c | d | e | f | g | h |
205| x + b | = | b | d | h | c | f | a | e | g |
206#+end_quote
207#+html: </i>