From 252df6c74c7be9b82aa89cdb4972f91c87b06184 Mon Sep 17 00:00:00 2001 From: Comrade Martin Miroslavovich Michalec Date: Mon, 27 Nov 2023 00:34:11 +0300 Subject: publish --- README.org | 207 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 207 insertions(+) create mode 100644 README.org (limited to 'README.org') diff --git a/README.org b/README.org new file mode 100644 index 0000000..a38a91a --- /dev/null +++ b/README.org @@ -0,0 +1,207 @@ +#+title: RPN calculator for multi-precision finite arithmetic + +* Task[fn:1] +Create a calculator for multi-precision finite arithmetic +(8 digits) for four operations (​+, -, *, ÷) based on single-precision +finite arithmetic, where the "​+​1" rule is defined and the properties +of commutativity (​+, *), associativity (​+, *), and distributivity of * +over + are satisfied; an additive identity "a" and a multiplicative +identity "b" are defined; and the following property holds: for (∀x) +x*a=a. Additionally, you can implement exponentiation, as well as the +search for GCD and LCM for two numbers. + +#+caption: The "+1" rule +#+attr_html: :style margin: auto; +| x | = | a | b | c | d | e | f | g | h | +| x + b | = | b | d | h | c | f | a | e | g | + +* Documentation +The exported report can be found at [[https://git.michalec.dev/uni/term-03/discrete-math/coursework/report.pdf][this link]]. + +* Showcase + +#+begin_src text +> jsadh +[-] 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*$' +> nop + +> +f + f + +> + f + f + +> dup + f + f + f + +> add + f + be + +> sub + -f + +> neg + f + +> -a + f + a + +> div +[*] INFO: division by zero +[*] INFO: operation resulted in empty set + +> +a + a + +> + a + a + +> div +[*] INFO: dividing zero by zero +[*] INFO: operation result is a range: [-ffffffff; ffffffff] + +> +ffffffff + ffffffff + +> + ffffffff + ffffffff + +> mul +[-] ERROR: operation has overflown + +> +ghf + ghf + +> -fe + ghf + -fe + +> mod + eb + +> +ghf + eb + ghf + +> -fe + eb + ghf + -fe + +> div + eb + -g + +> -fe + eb + -g + -fe + +> mul + eb + hee + +> add + ghf + +> inc + gga + +> + ggb + +> + ggd + +> + ggc + +> dec + ggd + +> + ggb + +> + gga + +> del + +> +[*] INFO: stack is already empty + +> clr +[*] INFO: stack is already empty + +> +d + d + +> +h + d + h + +> pow + da + +> del + +> +e + e + +> +h + e + h + +> gcd + d + +> +c + d + c + +> lcm + e + +> +f + e + f + +> swp + f + e + +> clr + +> ^Cinterrupt +#+end_src + +* Unlicense +#+include: UNLICENSE verse + +* Footnotes + +[fn:1] Original text: +#+html: +#+begin_quote +Сформировать калькулятор «большой» конечной арифметики (8 +разрядов) для четырех действий (​+, -, *, ÷)= на основе «малой» +конечной арифметики, где задано правило «+1» и выполняются свойства +коммутативности (​+, *), ассоциативности (​+, *), дистрибутивности * +относительно +, заданы аддитивная единица «a» и мультипликативная +единица «b», а также выполняется свойство: для (∀х) х*a=a. +Дополнительно можно реализовать возведение в степень, поиск НОД и НОК +для двух чисел. + +#+caption: Правило «+1»: +#+attr_html: :style margin: auto; +| x | = | a | b | c | d | e | f | g | h | +| x + b | = | b | d | h | c | f | a | e | g | +#+end_quote +#+html: -- cgit v1.3.1