﻿<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD with MathML3 v1.2 20190208//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd">
<article
    xmlns:mml="http://www.w3.org/1998/Math/MathML"
    xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="review-article">
  <front>
    <journal-meta>
      <journal-id journal-id-type="publisher-id">UJCSC</journal-id>
      <journal-title-group>
        <journal-title>Universal Journal of Computer Sciences and Communications</journal-title>
      </journal-title-group>
      <issn pub-type="epub"></issn>
      <issn pub-type="ppub"></issn>
      <publisher>
        <publisher-name>Science Publications</publisher-name>
      </publisher>
    </journal-meta>
    <article-meta>
      <article-id pub-id-type="doi">10.31586/ujcsc.2022.531</article-id>
      <article-id pub-id-type="publisher-id">UJCSC-531</article-id>
      <article-categories>
        <subj-group subj-group-type="heading">
          <subject>Review Article</subject>
        </subj-group>
      </article-categories>
      <title-group>
        <article-title>
          A Problem of Accuracy of Computer Calculations
        </article-title>
      </title-group>
      <contrib-group>
<contrib contrib-type="author">
<name>
<surname>Bilous</surname>
<given-names>Rostyslav V.</given-names>
</name>
<xref rid="af1" ref-type="aff">1</xref>
</contrib>
<contrib contrib-type="author">
<name>
<surname>Krykun</surname>
<given-names>Ivan H.</given-names>
</name>
<xref rid="af1" ref-type="aff">1</xref>
<xref rid="af2" ref-type="aff">2</xref>
<xref rid="cr1" ref-type="corresp">*</xref>
</contrib>
      </contrib-group>
<aff id="af1"><label>1</label> Department of Applied Mathematics, Vasyl&#x02019; Stus Donetsk National University, Vinnytsia, Ukraine</aff>
<aff id="af2"><label>2</label> Department of Theory of Control Systems of Institute of Applied Mathematics and Mechanics of NAS of Ukraine, Sloviansk, Ukraine </aff>
<author-notes>
<corresp id="c1">
<label>*</label>Corresponding author at: Department of Applied Mathematics, Vasyl’ Stus Donetsk National University, Vinnytsia, Ukraine
</corresp>
</author-notes>
      <pub-date pub-type="epub">
        <day>23</day>
        <month>12</month>
        <year>2022</year>
      </pub-date>
      <volume>1</volume>
      <issue>1</issue>
      <history>
        <date date-type="received">
          <day>23</day>
          <month>12</month>
          <year>2022</year>
        </date>
        <date date-type="rev-recd">
          <day>23</day>
          <month>12</month>
          <year>2022</year>
        </date>
        <date date-type="accepted">
          <day>23</day>
          <month>12</month>
          <year>2022</year>
        </date>
        <date date-type="pub">
          <day>23</day>
          <month>12</month>
          <year>2022</year>
        </date>
      </history>
      <permissions>
        <copyright-statement>&#xa9; Copyright 2022 by authors and Trend Research Publishing Inc. </copyright-statement>
        <copyright-year>2022</copyright-year>
        <license license-type="open-access" xlink:href="http://creativecommons.org/licenses/by/4.0/">
          <license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p>
        </license>
      </permissions>
      <abstract>
        The paper presented the results of the research related to the analysis of the reliability of computer calculations. Relevant examples of incorrect program operation were demonstrated: both quite simple and much less obvious, such as S. Rump's example. In addition to mathematical explanations, authors focused on purely software capabilities for controlling the accuracy of complex calculations. For this purpose, examples of effective use of the functionality of the decimal and fraction modules in Python 3.x were given.
      </abstract>
      <kwd-group>
        <kwd-group><kwd>Computer Calculations</kwd>
<kwd>Errors</kwd>
<kwd>Programming</kwd>
<kwd>Floating Point Numbers</kwd>
</kwd-group>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec1">
<title>Introduction</title><p>The problem of reliability (accuracy) of computer calculations is one of the fundamental problems of computer science [
<xref ref-type="bibr" rid="R1">1</xref>,<xref ref-type="bibr" rid="R2">2</xref>]. Physical limitations on the amount of memory allocated by computer technology for number processing impose fundamental limitations on the possibilities and logic of organizing computer calculations, which also requires the involvement of specific mathematical research methods.</p>
<p>At the same time, the problem is not only the possibility of an incorrect result of theoretical research. As practice shows, the consequences of incorrect computer calculations can be catastrophic. There is a famous case: on February 25, 1991, during the Gulf War I (Operation Desert Storm), a &#x26;#x0201c;Patriot&#x26;#x0201d; air defence system failed to intercept an enemy missile, and the projectile hit a barracks of US soldiers, killing 28 people. An official investigation [
<xref ref-type="bibr" rid="R3">3</xref>] showed that 24-bit interceptor processors make a time conversion error of 0,013 seconds every hour. &#x26;#x0201c;Patriot&#x26;#x0201d; was not restarted for more than 100 hours, and as a result of the accumulation of such seemingly minor errors, during this time there was an error in calculating the position of the missile at 600 meters.</p>
<p>Almost any academic textbook about calculation methods &#x26;#x02013; an integral discipline of the training course for both physical and mathematical specialists and computer science specialists &#x26;#x02013; usually contains only mathematical information about errors and the accuracy limits of calculations. The applied side of the issue, i.e. the computer implementation of calculations, remains out of consideration. Technical disciplines, such as &#x26;#x0201c;Programming&#x26;#x0201d;, usually provide only the basic concepts of converting numbers to a binary code and back, and provide only general information about the existing standards for representing floating-point numbers.</p>
<p>Ignoring the fundamentals of binary arithmetic and the principles of the IEEE-754 standard [
<xref ref-type="bibr" rid="R4">4</xref>] can significantly affect the correctness of both theoretical research (if software or computer equipment was used for modelling) and simply the quality of the product when developing application programs.</p>
<p>Programs are implemented in C++, Java, or Python programming languages, depending on when it is more appropriate: in C++ and Java, we can visually experiment by changing the types of floating-point numbers, float and double; in Python, by default, &#x26;#x0201c;long&#x26;#x0201d; arithmetic is implemented, that is, a set of algorithms for bitwise work with numbers of arbitrary length.</p>
</sec><sec id="sec2">
<title>Examples of errors in computer calculations</title><p>Consider the following example of a feature of computer calculations. Let's check with the help of the C++ programming language, whether the distributive law is fulfilled in computer calculations. Two simple program codes for this can be seen inFigure <xref ref-type="fig" rid="fig1"> 1</xref> below.</p>
<fig id="fig1">
<label>Figure 1</label>
<caption>
<p>Program codes in the C++ programming language for checking of the fulfilment the distributive law: <b>(a)</b> for numbers 0,987, 0,278, and 1,268 in <i>double</i> format; <b>(b) </b>for numbers 0,9871, 0,2781, and 1,268 in <i>float</i> format</p>
</caption>
<graphic xlink:href="531.fig.001" />
</fig><p>As expected, for code inFigure <xref ref-type="fig" rid="fig1"> 1</xref> (a) we get a result of <math><semantics><mrow><mn>1</mn></mrow></semantics></math> (i.e. ). </p>
<p>Let's slightly change the values of the numbers a and b, increasing them by 0,0001 (that is, we will change the numbers <italic>a</italic> and <italic>b</italic> by <math><semantics><mrow><mn>0,01</mn><mi>%</mi></mrow></semantics></math> and <math><semantics><mrow><mn>0,04</mn><mi>%</mi></mrow></semantics></math>, respectively). As a result, we will get a result of <math><semantics><mrow><mn>0</mn></mrow></semantics></math> (<math><semantics><mrow><mi>f</mi><mi>a</mi><mi>l</mi><mi>s</mi><mi>e</mi></mrow></semantics></math>). </p>
<p>If we output to the console the corresponding values for the case <math><semantics><mrow><mi>a</mi><mo>=</mo><mn>0,9871</mn></mrow></semantics></math> and <math><semantics><mrow><mi>b</mi><mo>=</mo><mn>0,2781</mn></mrow></semantics></math> with an accuracy of 20 decimal places, the program will issue:</p>
<p><math> <semantics>  <mrow>   <mi>a</mi><mo>&#x22C5;</mo><mi>c</mi><mo>+</mo><mi>b</mi><mo>&#x22C5;</mo><mi>c</mi><mo>&#x2192;</mo><mn>1</mn><mo>,</mo><mn>60427359999999996631</mn><mo>,</mo></mrow>   </semantics></math></p>
<p><math> <semantics>  <mrow>   <mrow><mo>(</mo>    <mrow>     <mi>a</mi><mo>+</mo><mi>b</mi></mrow>   <mo>)</mo></mrow><mo>&#x22C5;</mo><mi>c</mi><mo>&#x2192;</mo><mn>1</mn><mo>,</mo><mn>60427360000000018836.</mn></mrow>   </semantics></math> </p>
<p>So we get different values, which are insignificant but differ from the real value of <math><semantics><mrow><mn>1,6042736</mn></mrow></semantics></math> (the absolute error is <math> <semantics>  <mrow>   <mn>3</mn><mo>,</mo><mn>4</mn><mo>&#x22C5;</mo><msup>    <mrow>     <mn>10</mn></mrow>    <mrow>     <mo>&#x2212;</mo><mn>17</mn></mrow>   </msup>   </mrow>   </semantics></math> and <math> <semantics>  <mrow>   <mn>1</mn><mo>,</mo><mn>9</mn><mo>&#x22C5;</mo><msup>    <mrow>     <mn>10</mn></mrow>    <mrow>     <mo>&#x2212;</mo><mn>16</mn></mrow>   </msup>   </mrow>   </semantics></math>). </p>
<p>Let's change the types of variables in the program to <italic>float</italic> (Figure 1 (b)), and as a result, we will already get the result <math> <semantics>  <mrow>   <mi>t</mi><mi>r</mi><mi>u</mi><mi>e</mi></mrow>   </semantics></math>. That is, it is the reduction in the accuracy of the calculations that returns us to the correct result from a mathematical point of view, which at first glance looks somewhat paradoxical.</p>
</sec><sec id="sec3">
<title>Representation of numbers in the IEEE-754 standard</title><p>The above complexities of computer calculations arise from the way real numbers are represented in computer memory, regulated by IEEE-754 standards.</p>
<p>The description of the IEEE-754 standard goes beyond the scope of this work, so we will limit ourselves to the demonstration of the representation of numbers from the example described above in <italic>float</italic> and <italic>double</italic> formats.</p>
<p><italic>Float</italic> format: 32 bits are allocated to the number: the first bit is the sign bit (if the sign bit is 0, the number is non-negative (positive or zero); if the sign bit is 1 then the number is negative), the next 8 bits are allocated to the exponent, and the last 23 bits are allocated to the normalized mantissa. This is shown schematically inFigure <xref ref-type="fig" rid="fig2"> 2</xref> below.</p>
<fig id="fig2">
<label>Figure 2</label>
<caption>
<p>Representation of a number in <i>float</i> format in the IEEE-754 standard</p>
</caption>
<graphic xlink:href="531.fig.002" />
</fig><p><italic>Double</italic> format (i.e. double-precision format): 64 bits are allocated to the number: the first bit is the sign bit &#x26;#x02013; the bit that indicates the sign of a number; 11 bits are allocated to the exponent, and the last 52 bits are accordingly allocated to the normalized mantissa (Figure 2).</p>
<fig id="fig3">
<label>Figure 3</label>
<caption>
<p>Representation of a number in the <i>double</i> format in the IEEE-754 standard</p>
</caption>
<graphic xlink:href="531.fig.003" />
</fig><p>A simple example of comparing these two formats is comparing the same number in different formats using the Java 8 programming language.</p>
<fig id="fig4">
<label>Figure 4</label>
<caption>
<p>The program for comparing of the number 0,3 presented in different formats</p>
</caption>
<graphic xlink:href="531.fig.004" />
</fig><p>This example compares the number 0,3 represented in <italic>float</italic> and <italic>double</italic> formats. </p>
<fig id="fig5">
<label>Figure 5</label>
<caption>
<p>The result of the program from Figure 4</p>
</caption>
<graphic xlink:href="531.fig.005" />
</fig><p>As a result, we can see that the absolute values of two seemingly identical numbers are not equal to each other and have a significant difference when it comes to the accuracy of calculations.</p>
</sec><sec id="sec4">
<title>The Rump&#x02019;s example</title><p>Next, we will consider the example proposed by S. Rump [
<xref ref-type="bibr" rid="R5">5</xref>] back in 1988. It is necessary to calculate the value of the expression</p>
<p><math> <semantics>  <mrow>   <mi>f</mi><mrow><mo>(</mo>    <mrow>     <mi>x</mi><mo>,</mo><mi>y</mi></mrow>   <mo>)</mo></mrow><mo>=</mo><mn>333</mn><mo>,</mo><mn>75</mn><mo>&#x22C5;</mo><msup>    <mi>y</mi>    <mn>6</mn>   </msup>   <mo>+</mo><msup>    <mi>x</mi>    <mn>2</mn>   </msup>   <mo>&#x22C5;</mo><mrow><mo>(</mo>    <mrow>     <mn>11</mn><mo>&#x22C5;</mo><msup>      <mi>x</mi>      <mn>2</mn>     </msup>     <msup>      <mi>y</mi>      <mn>2</mn>     </msup>     <mo>&#x2212;</mo><msup>      <mi>y</mi>      <mn>6</mn>     </msup>     <mo>&#x2212;</mo><mn>121</mn><mo>&#x22C5;</mo><msup>      <mi>y</mi>      <mn>4</mn>     </msup>     <mo>&#x2212;</mo><mn>2</mn></mrow>   <mo>)</mo></mrow><mo>+</mo><mn>5</mn><mo>,</mo><mn>5</mn><mo>&#x22C5;</mo><msup>    <mi>y</mi>    <mn>8</mn>   </msup>   <mo>+</mo><mfrac>    <mi>x</mi>    <mrow>     <mn>2</mn><mi>y</mi></mrow>   </mfrac>   </mrow>   </semantics></math></p>
<p>at the point <math><semantics><mrow><mo>(</mo><mn>77617</mn><mi> </mi><mo>;</mo><mi> </mi><mn>33096</mn><mo>)</mo></mrow></semantics></math>.</p>
<p>The task looks quite simple. If we temporarily ignore the last term <math> <semantics>  <mrow>   <mfrac>    <mi>x</mi>    <mrow>     <mn>2</mn><mi>y</mi></mrow>   </mfrac>   </mrow>   </semantics></math> (which is not really important), and considering that <math> <semantics>  <mrow>   <mi>y</mi><mo>&#x00A0;</mo><mo>=</mo><mo>&#x00A0;</mo><mn>33096</mn></mrow>   </semantics></math> is an even number, it is obvious that the value of the expression <math> <semantics>  <mrow>   <mi>f</mi><mrow><mo>(</mo>    <mrow>     <mi>x</mi><mo>,</mo><mi>y</mi></mrow>   <mo>)</mo></mrow><mo>&#x2212;</mo><mfrac>    <mi>x</mi>    <mrow>     <mn>2</mn><mi>y</mi></mrow>   </mfrac>   </mrow>   </semantics></math> in general must be an integer.</p>
<p>To implement the Rump&#x26;#x02019;s example, we will use Python 3</p>
<fig id="fig6">
<label>Figure 6</label>
<caption>
<p>The program implementation of the Rump&#x02019;s example</p>
</caption>
<graphic xlink:href="531.fig.006" />
</fig><p>The result of executing the program inFigure <xref ref-type="fig" rid="fig6"> 6</xref> will be the value <math> <semantics>  <mrow>   <mn>1180591620717411303424</mn><mo>,</mo></mrow>   </semantics></math> although in fact</p>
<p><math> <semantics>  <mrow>   <mi>f</mi><mrow><mo>(</mo>    <mrow>     <mn>77617</mn><mo>,</mo><mn>33096</mn></mrow>   <mo>)</mo></mrow><mo>=</mo><mo>&#x2212;</mo><mfrac>    <mrow>     <mn>54767</mn></mrow>    <mrow>     <mn>66192</mn></mrow>   </mfrac>   </mrow>   </semantics></math></p>
<p>The characteristic problem is precisely at the point <math> <semantics>  <mrow>   <mo stretchy='false'>(</mo><mn>77617</mn><mo>;</mo><mn>33096</mn><mo stretchy='false'>)</mo><mo>.</mo></mrow>   </semantics></math> </p>
<p>Let's explain what is special about this point. Let's separate the positive and negative parts of the expression (as already mentioned: the last addition of <math> <semantics>  <mrow>   <mfrac>    <mi>x</mi>    <mrow>     <mn>2</mn><mi>y</mi></mrow>   </mfrac>   </mrow>   </semantics></math> does not really significantly affect the correctness of the calculation result). Let's separate the positive and negative parts of the expression <math> <semantics>  <mrow>   <mrow><mo>(</mo>    <mrow>     <mi>x</mi><mo>,</mo><mi>y</mi></mrow>   <mo>)</mo></mrow><mo>&#x2212;</mo><mfrac>    <mi>x</mi>    <mrow>     <mn>2</mn><mi>y</mi></mrow>   </mfrac>   </mrow>   </semantics></math> , as shown inFigure <xref ref-type="fig" rid="fig7"> 7</xref>.</p>
<fig id="fig7">
<label>Figure 7</label>
<caption>
<p>The program implementation of the Rump&#x02019;s example with separated positive and negative parts</p>
</caption>
<graphic xlink:href="531.fig.007" />
</fig><p>We will get the result</p>
<p><math> <semantics>  <mrow>   <mi>p</mi><mi>o</mi><mi>s</mi><mi>i</mi><mi>t</mi><mi>i</mi><mi>v</mi><mi>e</mi><mtext>&#x00A0;</mtext><mo>=</mo><mtext>&#x00A0;</mtext><mn>7917112216566288664689761316426849984</mn><mo>;</mo></mrow>   </semantics></math> </p>
<p><math> <semantics>  <mrow>   <mi>n</mi><mi>e</mi><mi>g</mi><mi>a</mi><mi>t</mi><mi>i</mi><mi>v</mi><mi>e</mi><mtext>&#x00A0;</mtext><mo>=</mo><mtext>&#x00A0;</mtext><mn>7917112216566288664689761316426849986.</mn></mrow>   </semantics></math></p>
<p></p>
<p>That is, in our example </p>
<p><math> <semantics>  <mrow>   <mi>p</mi><mi>o</mi><mi>s</mi><mi>i</mi><mi>t</mi><mi>i</mi><mi>v</mi><mi>e</mi><mo>&#x2013;</mo><mi>n</mi><mi>e</mi><mi>g</mi><mi>a</mi><mi>t</mi><mi>i</mi><mi>v</mi><mi>e</mi><mo>=</mo><mo>&#x2212;</mo><mn>2</mn><mo>,</mo></mrow>   </semantics></math></p>
<p>so final result coincides with the mathematical one. The fact is that one of the main problems when working with floating-point numbers is the subtraction operation, because when subtracting numbers close in value, significant digits may be lost, and the result in this case will be incorrect. </p>
<p>If we change one line in the program by replacing integer division (//) with regular division (/), that is</p>
<p><math> <semantics>  <mrow>   <mi>p</mi><mi>o</mi><mi>s</mi><mi>i</mi><mi>t</mi><mi>i</mi><mi>v</mi><mi>e</mi><mo>=</mo><mfrac>    <mrow>     <mn>1335</mn><mo>&#x22C5;</mo><msup>      <mi>y</mi>      <mn>6</mn>     </msup>     </mrow>    <mn>4</mn>   </mfrac>   <mo>+</mo><msup>    <mi>x</mi>    <mn>2</mn>   </msup>   <mo>&#x22C5;</mo><mrow><mo>(</mo>    <mrow>     <mn>11</mn><mo>&#x22C5;</mo><msup>      <mi>x</mi>      <mn>2</mn>     </msup>     <msup>      <mi>y</mi>      <mn>2</mn>     </msup>     </mrow>   <mo>)</mo></mrow><mo>+</mo><mfrac>    <mrow>     <mn>11</mn><mo>&#x22C5;</mo><msup>      <mi>y</mi>      <mn>8</mn>     </msup>     </mrow>    <mn>2</mn>   </mfrac>   </mrow>   </semantics></math></p>
<p></p>
<p>so the value of the variable &#x26;#x0d835;&#x26;#x0dc5d;&#x26;#x0d835;&#x26;#x0dc5c;&#x26;#x0d835;&#x26;#x0dc60;&#x26;#x0d835;&#x26;#x0dc56;&#x26;#x0d835;&#x26;#x0dc61;&#x26;#x0d835;&#x26;#x0dc56;&#x26;#x0d835;&#x26;#x0dc63;&#x26;#x0d835;&#x26;#x0dc52; will be equal to</p>
<p><math> <semantics>  <mrow>   <mi>p</mi><mi>o</mi><mi>s</mi><mi>i</mi><mi>t</mi><mi>i</mi><mi>v</mi><mi>e</mi><mtext>&#x00A0;</mtext><mo>=</mo><mtext>&#x00A0;</mtext><mn>7917112216566288629721075632129966080</mn></mrow>   </semantics></math></p>
<p>and the difference between the values of &#x26;#x0d835;&#x26;#x0dc5d;&#x26;#x0d835;&#x26;#x0dc5c;&#x26;#x0d835;&#x26;#x0dc60;&#x26;#x0d835;&#x26;#x0dc56;&#x26;#x0d835;&#x26;#x0dc61;&#x26;#x0d835;&#x26;#x0dc56;&#x26;#x0d835;&#x26;#x0dc63;&#x26;#x0d835;&#x26;#x0dc52; and &#x26;#x0d835;&#x26;#x0dc5b;&#x26;#x0d835;&#x26;#x0dc52;&#x26;#x0d835;&#x26;#x0dc54;&#x26;#x0d835;&#x26;#x0dc4e;&#x26;#x0d835;&#x26;#x0dc61;&#x26;#x0d835;&#x26;#x0dc56;&#x26;#x0d835;&#x26;#x0dc63;&#x26;#x0d835;&#x26;#x0dc52; will be already</p>
<p><math> <semantics>  <mrow>   <mo>&#x2212;</mo><mn>34968685684296883906.</mn></mrow>   </semantics></math></p>
<p>If we rewrite the expression for the variable <math><semantics><mrow><mi>p</mi><mi>o</mi><mi>s</mi><mi>i</mi><mi>t</mi><mi>i</mi><mi>v</mi><mi>e</mi></mrow></semantics></math> in a format more familiar to the Python user</p>
<p><math> <semantics>  <mrow>   <mi>p</mi><mi>o</mi><mi>s</mi><mi>i</mi><mi>t</mi><mi>i</mi><mi>v</mi><mi>e</mi><mo>=</mo><mfrac>    <mrow>     <mn>1335</mn></mrow>    <mn>4</mn>   </mfrac>   <mo>&#x22C5;</mo><msup>    <mi>y</mi>    <mn>6</mn>   </msup>   <mo>+</mo><msup>    <mi>x</mi>    <mn>2</mn>   </msup>   <mo>&#x22C5;</mo><mrow><mo>(</mo>    <mrow>     <mn>11</mn><mo>&#x22C5;</mo><msup>      <mi>x</mi>      <mn>2</mn>     </msup>     <mo>&#x22C5;</mo><msup>      <mi>y</mi>      <mn>2</mn>     </msup>     </mrow>   <mo>)</mo></mrow><mo>+</mo><mfrac>    <mrow>     <mn>11</mn></mrow>    <mn>2</mn>   </mfrac>   <mo>&#x22C5;</mo><msup>    <mi>y</mi>    <mn>8</mn>   </msup>   <mo>,</mo></mrow>   </semantics></math></p>
<p></p>
<p>then the value of &#x26;#x0d835;&#x26;#x0dc5d;&#x26;#x0d835;&#x26;#x0dc5c;&#x26;#x0d835;&#x26;#x0dc60;&#x26;#x0d835;&#x26;#x0dc56;&#x26;#x0d835;&#x26;#x0dc61;&#x26;#x0d835;&#x26;#x0dc56;&#x26;#x0d835;&#x26;#x0dc63;&#x26;#x0d835;&#x26;#x0dc52; will be equal to</p>
<p><math> <semantics>  <mrow>   <mi>p</mi><mi>o</mi><mi>s</mi><mi>i</mi><mi>t</mi><mi>i</mi><mi>v</mi><mi>e</mi><mtext>&#x00A0;</mtext><mo>=</mo><mtext>&#x00A0;</mtext><mn>7917112216566289810312696349541269504</mn></mrow>   </semantics></math></p>
<p>since different rounding errors are given in signs for different arithmetic operations (as we already noted in the previous section: the order of operations also matters for the accuracy of calculations). The difference in this case between the received positive value and the previous one will be <math> <semantics>  <mrow>   <mn>1180591620717411303424</mn><mo>,</mo></mrow>   </semantics></math> and the value</p>
<p><math> <semantics>  <mrow>   <mi>p</mi><mi>o</mi><mi>s</mi><mi>i</mi><mi>t</mi><mi>i</mi><mi>v</mi><mi>e</mi><mtext>&#x00A0;</mtext><mo>&#x2013;</mo><mtext>&#x00A0;</mtext><mi>n</mi><mi>e</mi><mi>g</mi><mi>a</mi><mi>t</mi><mi>i</mi><mi>v</mi><mi>e</mi><mtext>&#x00A0;</mtext><mo>=</mo><mn>1145622935033114419518.</mn></mrow>   </semantics></math></p>
<p>Correctly change the sequence of performing arithmetic operations and immediately get errors of the order .</p>
</sec><sec id="sec5">
<title>Conclusions and prospects for further research</title><p>It should be noted that Python has the ability to a certain extent to eliminate some problems arising from calculations with floating-point numbers &#x26;#x02013; for example, using the functionality of the decimal module to control the accuracy of calculations. The official documentation for the decimal module can be found at [
<xref ref-type="bibr" rid="R6">6</xref>]. Without going into unnecessary details, we note that the decimal module (in particular, the Decimal class) makes it possible to work with floating-point numbers as with ordinary fractions.</p>
<p>With all of the above, for example, only using the capabilities of the Decimal class seems insufficient. Skipping several intermediate stages of the research, the author found a way to get the correct result of software calculations. This method consists in the joint use of the decimal module together with the application of the multiplication reduction scheme (Horner scheme), with the aim of reducing the number of arithmetic operations and increasing the accuracy of calculations. In this case, we have to rewrite the expression  <math> <semantics>  <mrow>   <mi>f</mi><mrow><mo>(</mo>    <mrow>     <mi>x</mi><mo>,</mo><mi>y</mi></mrow>   <mo>)</mo></mrow><mo>&#x2212;</mo><mfrac>    <mi>x</mi>    <mrow>     <mn>2</mn><mi>y</mi></mrow>   </mfrac>   </mrow>   </semantics></math> in the form</p>
<p><math> <semantics>  <mrow>   <mi>f</mi><mrow><mo>(</mo>    <mrow>     <mi>x</mi><mo>,</mo><mi>y</mi></mrow>   <mo>)</mo></mrow><mo>=</mo><msup>    <mi>y</mi>    <mn>2</mn>   </msup>   <mo>&#x22C5;</mo><mrow><mo>(</mo>    <mrow>     <msup>      <mi>y</mi>      <mn>2</mn>     </msup>     <mo>&#x22C5;</mo><mrow><mo>(</mo>      <mrow>       <msup>        <mi>y</mi>        <mn>2</mn>       </msup>       <mo>&#x22C5;</mo><mrow><mo>(</mo>        <mrow>         <mn>5</mn><mo>,</mo><mn>5</mn><mo>&#x22C5;</mo><msup>          <mi>y</mi>          <mn>2</mn>         </msup>         <mrow><mo>(</mo>          <mrow>           <mn>333</mn><mo>,</mo><mn>75</mn><mo>&#x2212;</mo><msup>            <mi>x</mi>            <mn>2</mn>           </msup>           </mrow>         <mo>)</mo></mrow></mrow>       <mo>)</mo></mrow><mo>&#x2212;</mo><mn>121</mn><mo>&#x22C5;</mo><msup>        <mi>x</mi>        <mn>2</mn>       </msup>       </mrow>     <mo>)</mo></mrow><mo>+</mo><mn>11</mn><mo>&#x22C5;</mo><msup>      <mi>x</mi>      <mn>4</mn>     </msup>     </mrow>   <mo>)</mo></mrow><mo>&#x2212;</mo><mn>2</mn><mo>&#x22C5;</mo><msup>    <mi>x</mi>    <mn>2</mn>   </msup>   <mo>.</mo></mrow>   </semantics></math></p>
<p>We implement the described approach programmatically (Figure 8).</p>
<fig id="fig8">
<label>Figure 8</label>
<caption>
<p>The program implementation of the example using the reduced multiplication scheme</p>
</caption>
<graphic xlink:href="531.fig.008" />
</fig><p>In the result we get expected value .</p>
<p>The described examples can be called linear, since the reasons for the occurrence of calculation features become obvious even with a cursory analysis, if we take into account the IEEE-754 standard.</p>
<p>The question of using the results mentioned in the paper, in particular, in the modelling of random and natural processes was considered in recent studies of such processes [
<xref ref-type="bibr" rid="R7">7</xref>,<xref ref-type="bibr" rid="R8">8</xref>,<xref ref-type="bibr" rid="R9">9</xref>,<xref ref-type="bibr" rid="R10">10</xref>,<xref ref-type="bibr" rid="R11">11</xref>,<xref ref-type="bibr" rid="R12">12</xref>,<xref ref-type="bibr" rid="R13">13</xref>,<xref ref-type="bibr" rid="R14">14</xref>,<xref ref-type="bibr" rid="R15">15</xref>,<xref ref-type="bibr" rid="R16">16</xref>].</p>
<p></p>
<p><bold>Author Contributions:</bold> All authors have read and agreed to the published version of the manuscript.</p>
<p><bold>Funding:</bold> This research received no external funding.</p>
<p><bold>Acknowledgments:</bold> The authors express their heartfelt gratitude to the brave soldiers of the Ukrainian Armed Forces who protect the lives of the authors and their families from Russian bloody murderers since 2014.</p>
<p><bold>Conflicts of Interest:</bold> The authors declare no conflict of interest.</p>
</sec>
  </body>
  <back>
    <ref-list>
      <title>References</title>
      
<ref id="R1">
<label>[1]</label>
<mixed-citation publication-type="other">Kopec, D. Classic Computer Science in Phyton, Manning Publications: Shelter Island, NY, USA, 2019.
</mixed-citation>
</ref>
<ref id="R2">
<label>[2]</label>
<mixed-citation publication-type="other">Kopec, D. Classic Computer Science in Java, Manning Publications: Shelter Island, NY, USA, 2020.
</mixed-citation>
</ref>
<ref id="R3">
<label>[3]</label>
<mixed-citation publication-type="other">Patriot Missile Defense: Software Problem Led to System Failure at Dhahran, Saudi Arabia: IMTEC-92-26, 1992. Available online: https://www.gao.gov/assets/220/215614.pdf (accessed on 25/09/2022).
</mixed-citation>
</ref>
<ref id="R4">
<label>[4]</label>
<mixed-citation publication-type="other">IEEE Standard for Floating-Point Arithmetic. Available online: https://irem.univ-reunion.fr/IMG/pdf/ieee-754-2008.pdf (ac-cessed on 25/09/2022).
</mixed-citation>
</ref>
<ref id="R5">
<label>[5]</label>
<mixed-citation publication-type="other">Rump, S.M. Algorithms for Verified Inclusions: Theory and Practice. In: Reliability in Computing: The Role of Interval Methods in Scientific Computing; Moore, R. E. (ed.) Academic Press: Boston, USA, 1988; pp. 109-126.
</mixed-citation>
</ref>
<ref id="R6">
<label>[6]</label>
<mixed-citation publication-type="other">Decimal fixed point and floating point arithmetic. Available online: https://docs.python.org/3/library/decimal.html (accessed on 25/09/2022).
</mixed-citation>
</ref>
<ref id="R7">
<label>[7]</label>
<mixed-citation publication-type="other">Krykun, I.H. Large deviation principle for stochastic equations with local time. Theory of Stochastic Processes 2009. 15(31), No. 2. pp. 140-155.
</mixed-citation>
</ref>
<ref id="R8">
<label>[8]</label>
<mixed-citation publication-type="other">Krykun, I.H. Functional law of the iterated logarithm type for a skew Brownian motion. Teorija Imovirnostej ta Matematychna Statystyka 2012, 87. pp. 60-77 (in Ukrainian)
</mixed-citation>
</ref>
<ref id="R9">
<label>[9]</label>
<mixed-citation publication-type="other">Krykun, I.H.; Makhno, S.Ya. The Peano phenomenon for It&#x000f4; equations. Journal of Mathematical Sciences 2013, 192, Issue 4, pp. 441-458. DOI: 10.1007/s10958-013-1407-5
</mixed-citation>
</ref>
<ref id="R10">
<label>[10]</label>
<mixed-citation publication-type="other">Krykun, I.H. Functional law of the iterated logarithm type for a skew Brownian motion. Theory of Probability and Mathematical Statistics 2013, 87, pp. 79-98. DOI: 10.1090/S0094-9000-2014-00906-0
</mixed-citation>
</ref>
<ref id="R11">
<label>[11]</label>
<mixed-citation publication-type="other">Krykun, I.H. Convergence of skew Brownian motions with local times at several points that are contracted into a single one. Journal of Mathematical Sciences 2017, 221, Issue 5, pp. 671-678. DOI: 10.1007/s10958-017-3258-y
</mixed-citation>
</ref>
<ref id="R12">
<label>[12]</label>
<mixed-citation publication-type="other">Krykun, I.H. The Arc-Sine Laws for the Skew Brownian Motion and Their Interpretation. Journal of Applied Mathematics and Physics 2018, 6, No. 2, pp. 347-357. DOI: 10.4236/jamp.2018.62033
</mixed-citation>
</ref>
<ref id="R13">
<label>[13]</label>
<mixed-citation publication-type="other">Krykun, I. H. The Arctangent Regression and the Estimation of Parameters of the Cauchy Distribution. Journal of Mathemati-cal Sciences 2020, 249, Issue 5, pp. 739-753.
</mixed-citation>
</ref>
<ref id="R14">
<label>[14]</label>
<mixed-citation publication-type="other">Krykun, I.H. The arcsine laws in the modelling of the natural processes depending on random factors. In Physical and mathe-matical justification of scientific achievements: collective monograph, Primedia eLaunch LLC: Boston, USA, 2020; pp. 24-33. DOI: 10.46299/ISG.2020.MONO.PHYSICAL.III
</mixed-citation>
</ref>
<ref id="R15">
<label>[15]</label>
<mixed-citation publication-type="other">Krykun, I.H. New Approach to Statistical Analysis of Election Results. International Journal of Mathematical, Engineering, Bio-logical and Applied Computing 2022, 1, No. 2, pp. 68-76. DOI: 10.31586/ijmebac.2022.466
</mixed-citation>
</ref>
<ref id="R16">
<label>[16]</label>
<mixed-citation publication-type="other">Cherniichuk, H.P.; Krykun, I.H. Notes about Winning Strategies for Some Combinatorial Games. Journal of Mathematics Let-ters 2022, 1 No.1, pp.1-9. DOI: 10.31586/jml.2022.496
</mixed-citation>
</ref>
    </ref-list>
  </back>
</article>