<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 29/01/2019 à 23:10, Federico Miyara
      a écrit :<br>
    </div>
    <blockquote type="cite" cite="mid:5C50CF4F.4040302@fceia.unr.edu.ar">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      <br>
      <font face="Courier New, Courier, monospace">Stephane,<br>
      </font><br>
      <blockquote cite="mid:916859f7-6573-cf33-a2ee-452c30f08120@utc.fr"
        type="cite">
        <blockquote type="cite"
          cite="mid:5C50AE20.1000004@fceia.unr.edu.ar">However, I must
          say that acos(1-%eps) gives on my Scilab 6.0.1 (Windows 7, i7
          processor) a result of <br>
        </blockquote>
        Federico, you have to try 1+%eps or -1-%eps !<br>
      </blockquote>
      <br>
      acos(x) with x > 1 is indeed imaginary, so there is no
      unexpected result.<br>
      <br>
      However, I see now that it hadn't been said that in-domain
      arguments yielded complex results but -1 - %eps was the culprit.<br>
      <br>
      But, for instance, <br>
      <br>
      min([-1-%eps, -1-%eps*2/3, -1, -1+ %eps, -0.9]) >= -1   <br>
      <br>
      is false (on my system), so the test performed by Paul Carrico
      would not succeed if there were a -1-%eps among the values of the
      vector.<br>
      <br>
      Only when alpha*%eps  with alpha < 0.5 is the minimum the test
      is successful, but in such case acos() yields a value close to
      %pi, not a complex value<br>
      <br>
      --> acos(-1 - 0.499*%eps)<br>
       ans  =<br>
      <br>
         3.141592653589793100000<br>
    </blockquote>
    <p>logical, since</p>
    <p>--> -1 - 0.499*%eps == -1<br>
       ans  =<br>
      <br>
        T<br>
    </p>
    <p>--> acos(-1 - 0.499*%eps)==%pi<br>
       ans  =<br>
      <br>
        T<br>
      <br>
    </p>
    <p>S.<br>
    </p>
    <blockquote type="cite" cite="mid:5C50CF4F.4040302@fceia.unr.edu.ar">
      <br>
      When alpha > 0.5 the test is not successful nor is the acos()
      real:<br>
      <br>
      --> acos(-1 - 0.50000001*%eps)<br>
       ans  =<br>
      <br>
         3.141592653589793100000 - 0.000000021073424255447i<br>
      <br>
      (this is a binary rounding situation since %eps is 2^-52)<br>
      <br>
      I think the original question is not completely solved. Why a
      number that is not smaller to -1 (asuming the min test is
      successful) yields a complex acos?<br>
      <br>
      An why it does in some systems and not in others? (Assuming Paul's
      report is accurate) <br>
      <br>
      There is another situation where this happens, when an fft is
      performed on a real signal, then filtered in the frequency domain
      and then the ifft is applied. The result should be real, but
      sometimes there are small imaginary parts. <br>
      <br>
      In this case there is a reason, complex exponentials are used in
      the algorithm so arithmetioc errors may not completely cancel out
      because of arithmetic and precision issues.<br>
      <br>
      Federico Miyara<br>
      <div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2">
        <br>
        <br>
        <hr style="border:none; color:#909090; background-color:#B0B0B0;
          height: 1px; width: 99%;">
        <table style="border-collapse:collapse;border:none;">
          <tbody>
            <tr>
              <td style="border:none;padding:0px 15px 0px 8px"> <a
href="https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/www.avast.com/antivirus"
                  moz-do-not-send="true"> <img
                    src="http://static.avast.com/emails/avast-mail-stamp.png"
                    alt="Avast logo" moz-do-not-send="true" border="0">
                </a> </td>
              <td>
                <p style="color:#3d4d5a;
font-family:"Calibri","Verdana","Arial","Helvetica";
                  font-size:12pt;"> El software de antivirus Avast ha
                  analizado este correo electrónico en busca de virus. <br>
                  <a
href="https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/www.avast.com/antivirus"
                    moz-do-not-send="true">www.avast.com</a> </p>
              </td>
            </tr>
          </tbody>
        </table>
        <br>
        <a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1"
          height="1" moz-do-not-send="true"> </a></div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users">https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users</a>
</pre>
    </blockquote>
  </body>
</html>