<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<font face="Courier New, Courier, monospace">I think it would be
interesting to include an input argument check in some functions
prone to give complex results in limiting cases (such as acos or
asin) so that if inside the domain (to within 1 %eps) where the
output argument should be real the imaginary part is canceled.
Something like this for scalars:<br>
<br>
</font>
<pre style="font-family:Monospaced;font-style:normal;font-size:14.0;"><span style="color:rgb(176,24,19);">function</span> <span style="color:rgb(131,67,16);font-weight:bold;">y</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(0,0,0);text-decoration:underline;">acos1</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">x</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(160,32,240);">if</span> <span style="color:rgb(50,185,185);">isreal</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">x</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(160,32,240);">if</span> <span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(92,92,92);"><=</span><span style="color:rgb(131,67,16);font-weight:bold;">x</span> <span style="color:rgb(92,92,92);">&</span> <span style="color:rgb(131,67,16);font-weight:bold;">x</span><span style="color:rgb(92,92,92);"><=</span><span style="color:rgb(188,143,143);">1</span>
<span style="color:rgb(131,67,16);font-weight:bold;">y</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">real</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(50,185,185);">acos</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">x</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(160,32,240);">else</span>
<span style="color:rgb(131,67,16);font-weight:bold;">y</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">acos</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">x</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(160,32,240);">end</span>
<span style="color:rgb(160,32,240);">end</span>
<span style="color:rgb(176,24,19);">endfunction</span></pre>
<br>
However, I must say that acos(1-%eps) gives on my Scilab 6.0.1
(Windows 7, i7 processor) a result of <br>
<br>
0.000000021073424255447, <br>
<br>
being %eps <br>
<br>
0.0000000000000002220446<br>
<br>
I get no imaginary part. I guess there must be some dependency on
the arithmetic engine.<br>
<br>
<br>
<div class="moz-cite-prefix">Federico Miyara<br>
<br>
<br>
On 29/01/2019 12:58, Stéphane Mottelet wrote:<br>
</div>
<blockquote cite="mid:dd8de4d8-e037-5065-eb80-b3402670bb6f@utc.fr"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<div class="moz-cite-prefix">It is the same if x is slightly >
1:</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">--> x=1+%eps<br>
x = <br>
<br>
1.<br>
<br>
<br>
--> acos(x)<br>
ans =<br>
<br>
2.107D-08i <br>
</div>
<div class="moz-cite-prefix"><br>
</div>
--> format(25); x <br>
x = <br>
<br>
1.0000000000000002220446
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Le 29/01/2019 à 16:55, Carrico, Paul
a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:3A6B7233274DB449A2A0053A47684F953FF1DAF9@BGS-EX01.auxitrol.ad">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Monospaced;
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
color:black;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman","serif";
color:black;}
pre
{mso-style-priority:99;
mso-style-link:"Préformaté HTML Car";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
color:black;
mso-fareast-language:EN-US;}
span.PrformatHTMLCar
{mso-style-name:"Préformaté HTML Car";
mso-style-priority:99;
mso-style-link:"Préformaté HTML";
font-family:"Courier New";
mso-fareast-language:FR;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1228345496;
mso-list-type:hybrid;
mso-list-template-ids:828263506 -180042942 67895299 67895301 67895297 67895299 67895301 67895297 67895299 67895301;}
@list l0:level1
{mso-level-start-at:13;
mso-level-number-format:bullet;
mso-level-text:-;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-font-family:Calibri;
mso-bidi-font-family:"Times New Roman";}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:12.0pt;color:#1F497D" lang="EN-US">When I
scroll to the list, the lowest (positive) value is 8.4<sup>E</sup>-08
(works fine) and no %eps .<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:12.0pt;color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:12.0pt;color:#1F497D" lang="EN-US">How
Can I check if %eps is in?<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:12.0pt;color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><a name="_____replyseparator"
moz-do-not-send="true"></a><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:FR">De :</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:FR">
users [<a moz-do-not-send="true"
class="moz-txt-link-freetext"
href="mailto:users-bounces@lists.scilab.org">mailto:users-bounces@lists.scilab.org</a>]
<b>De la part de</b> Stéphane Mottelet<br>
<b>Envoyé :</b> mardi 29 janvier 2019 16:50<br>
<b>À :</b> <a moz-do-not-send="true"
class="moz-txt-link-abbreviated"
href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br>
<b>Objet :</b> [EXTERNAL] Re: [Scilab-users] acos
leads to complex values<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Le 29/01/2019 à 16:45, Carrico, Paul a
écrit :<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span lang="EN-US">Dear All</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">I spent some time in
looking for a mistake in my code ; finally I’ve found
that the ACOS of a real vector leads to some complex
values (???)</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<pre><span style="font-size:12.0pt;font-family:"Monospaced","serif";color:#32B9B9" lang="ES">acos</span><span style="font-size:12.0pt;font-family:"Monospaced","serif";color:#4A55DB" lang="ES">(</span><span style="font-size:12.0pt;font-family:"Monospaced","serif"" lang="ES">Scar_P</span><span style="font-size:12.0pt;font-family:"Monospaced","serif";color:#4A55DB" lang="ES">(</span><span style="font-size:12.0pt;font-family:"Monospaced","serif";color:#FFAA00" lang="ES">:</span><span style="font-size:12.0pt;font-family:"Monospaced","serif"" lang="ES">,</span><span style="font-size:12.0pt;font-family:"Monospaced","serif";color:rosybrown" lang="ES">1</span><span style="font-size:12.0pt;font-family:"Monospaced","serif";color:#4A55DB" lang="ES">)</span><span style="font-size:12.0pt;font-family:"Monospaced&quo!
t;,"
;serif"" lang="ES"> </span><span style="font-size:12.0pt;font-family:"Monospaced","serif";color:#5C5C5C" lang="ES">./</span><span style="font-size:12.0pt;font-family:"Monospaced","serif"" lang="ES"> CM_x_CN</span><span style="font-size:12.0pt;font-family:"Monospaced","serif";color:#4A55DB" lang="ES">(</span><span style="font-size:12.0pt;font-family:"Monospaced","serif";color:#FFAA00" lang="ES">:</span><span style="font-size:12.0pt;font-family:"Monospaced","serif"" lang="ES">,</span><span style="font-size:12.0pt;font-family:"Monospaced","serif";color:rosybrown" lang="ES">1</span><span style="font-size:12.0pt;font-family:"Monospaced","serif";color:#4A55DB" lang="ES">))</span><o:p></o:p></pre>
</blockquote>
<p>Are your really sure, because we may have<o:p></o:p></p>
<p>--> x=-1-%eps <br>
x = <br>
<br>
-1.<br>
<br>
<br>
--> acos(x)<br>
ans =<br>
<br>
3.1415927 - 2.107D-08i<o:p></o:p></p>
<p>S.<o:p></o:p></p>
<p><o:p> </o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span style="font-size:12.0pt;font-family:"Monospaced","serif"" lang="ES"> </span><o:p></o:p></pre>
<p class="MsoNormal"><span lang="EN-US">(the formula worked
so far)</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">I checked that the
input values are correct:</span><o:p></o:p></p>
<p class="MsoListParagraph"
style="text-indent:-18.0pt;mso-list:l0 level1 lfo2"><!--[if !supportLists]--><span
style="mso-list:Ignore">-<span style="font:7.0pt
"Times New Roman""> </span></span><!--[endif]--><span
lang="EN-US">Comprised between [-1; 1] using MIN and MAX</span><o:p></o:p></p>
<p class="MsoListParagraph"
style="text-indent:-18.0pt;mso-list:l0 level1 lfo2"><!--[if !supportLists]--><span
style="mso-list:Ignore">-<span style="font:7.0pt
"Times New Roman""> </span></span><!--[endif]--><span
lang="EN-US">Composed only of real values using ISREAL
(all the vectors are correct)</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Thus I do not
understand why complex values appear ?</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">May it come from the
vectorization ?</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Paul</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman","serif";mso-fareast-language:FR"><br>
<br>
<o:p></o:p></span></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>users mailing list<o:p></o:p></pre>
<pre><a href="mailto:users@lists.scilab.org" moz-do-not-send="true">users@lists.scilab.org</a><o:p></o:p></pre>
<pre><a href="https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/urldefense.proofpoint.com/v2/url?u=https-3A__antispam.utc.fr_proxy_1_c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy_lists.scilab.org_mailman_listinfo_users&d=DwMG-g&c=0hKVUfnuoBozYN8UvxPA-w&r=4TCz--8bXfJhZZvIxJAemAJyz7Vfx78XvgYu3LN7eLo&m=rN8DsnGalih7CBHModSb9evOi3rmZRFFYcBFHTC71gU&s=RgKyyESZ7uSTxlU7V0nR42XTJybjC0Ar5fDcrouQThE&e=" moz-do-not-send="true">https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users</a><o:p></o:p></pre>
</blockquote>
<p><o:p> </o:p></p>
<pre>-- <o:p></o:p></pre>
<pre>Stéphane Mottelet<o:p></o:p></pre>
<pre>Ingénieur de recherche<o:p></o:p></pre>
<pre>EA 4297 Transformations Intégrées de la Matière Renouvelable<o:p></o:p></pre>
<pre>Département Génie des Procédés Industriels<o:p></o:p></pre>
<pre>Sorbonne Universités - Université de Technologie de Compiègne<o:p></o:p></pre>
<pre>CS 60319, 60203 Compiègne cedex<o:p></o:p></pre>
<pre>Tel : +33(0)344234688<o:p></o:p></pre>
<pre><a href="https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/urldefense.proofpoint.com/v2/url?u=http-3A__www.utc.fr_-7Emottelet&d=DwMG-g&c=0hKVUfnuoBozYN8UvxPA-w&r=4TCz--8bXfJhZZvIxJAemAJyz7Vfx78XvgYu3LN7eLo&m=rN8DsnGalih7CBHModSb9evOi3rmZRFFYcBFHTC71gU&s=34gC0H3RYWxwcKp7fr4bR5XFfy1acxO72YI9AYJJFhA&e=" moz-do-not-send="true">http://www.utc.fr/~mottelet</a><o:p></o:p></pre>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a moz-do-not-send="true" 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>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.utc.fr/%7Emottelet">http://www.utc.fr/~mottelet</a></pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<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="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<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;'>
<tr>
<td style='border:none;padding:0px 15px 0px 8px'>
<a href="https://www.avast.com/antivirus">
<img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" alt="Avast logo" />
</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://www.avast.com/antivirus">www.avast.com</a>
</p>
</td>
</tr>
</table>
<br />
<a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>