<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:newbie-02@gmx.de" title="b. <newbie-02@gmx.de>"> <span class="fn">b.</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED NOTABUG - Improve precision of function MOD() for big numbers (7^19 mod 13 is 6 not 7)"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=32862">bug 32862</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>newbie-02@gmx.de
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED NOTABUG - Improve precision of function MOD() for big numbers (7^19 mod 13 is 6 not 7)"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=32862#c6">Comment # 6</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED NOTABUG - Improve precision of function MOD() for big numbers (7^19 mod 13 is 6 not 7)"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=32862">bug 32862</a>
              from <span class="vcard"><a class="email" href="mailto:newbie-02@gmx.de" title="b. <newbie-02@gmx.de>"> <span class="fn">b.</span></a>
</span></b>
        <pre>calc calculates correctly - in this case and within it's limitations, 

the 'double' representation of 7^19 is 11398895185373144,00 you can 'see' the
digits hidden by calcs 'Standard' display format 1,13988951853731E+016
by '=RAWSUBTRACT(7^19;1,13988E+016)'

that's off by 1 from the correct value 11398895185373143, double-floats have a
granularity of '2' in this range, thus the result of the mod calculation is off
too, that's correct for calc, but not for users, 

to regain some harmony between the expectations of users - who think a computer
for several thousand bucks should be able to calculate better than they
themself - and the meager abilities of calc and ex$el, many ways would be
possible, two come to my mind immediately: 

- calculation results should be provided with information how accurate - or
inaccurate! - they are, and where one has to expect that the inaccuracy
violates the expectations of users, a warning should be given! 

- tasks for which in principle exact results are possible but not directly
reachable in fp-math should be calculated 'intelligently decomposed', e.g. in
extension of @Regina's approach in c#2 one could calculate '=mod(7^19;13)' as
'=mod(7^10;13) * mod(7^9;13)' - and take the whole again mod-13 as the product
might be >=13, so '=mod(mod(7^10;13) * mod(7^9;13);13)',  that holds, 

to recognize the necessity of such decompositions and to initiate them
intelligently is - automated - not trivial, but also not witchcraft, 

1st step i'd propose: each mathematical procedure is preceeded by a
'range-check' and if the operands exceed or fall below the range for which
exact results are possible a warning is issued, 

2nd step: after that 'calculation tricks' can be added bit by bit which extend
the capabilities of the procedures and are activated in case of 'off-range'
instead of the warning, 

the actual solution in calc to compute and display '0' for such tasks is ...
suboptimal ... user take that as a result instead of a warning</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>