<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi<br>
<br>
The function <b>clean </b>does that:<br>
<br>
<br>
clean(cos(%pi)+%i*sin(%pi))<br>
<br>
<br>
Note that the limited precision of floating point numbers is a
general issue in computer science.
<a class="moz-txt-link-freetext" href="http://en.wikipedia.org/wiki/Floating_point#Representable_numbers.2C_conversion_and_rounding">http://en.wikipedia.org/wiki/Floating_point#Representable_numbers.2C_conversion_and_rounding</a><br>
<br>
You should be aware of that for instance when testing numbers, as
in:<br>
<br>
if cos(%pi)+%i*sin(%pi) == -1<br>
disp("i am a mathematician")<br>
else<br>
disp("i am a computer")<br>
end<br>
<br>
if abs(cos(%pi)+%i*sin(%pi) +1)<1d-8<br>
disp("yep")<br>
else<br>
disp("nope")<br>
end<br>
<br>
or when you calculate indefinite integrals.<br>
<br>
Also note that some modules on ATOMS and scilabfilexchange allow
to make computation with arbitrary (but not infenitesimal)
precision.<br>
<br>
<br>
On 19/02/2014 15:15, Lester Anderson wrote:<br>
</div>
<blockquote
cite="mid:CAE3taFDdZ8oDBCYLxgNuie=KgvE5na8Q3t18Q77UOoc0OBrrYw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>Hello,</div>
<div> </div>
<div>Just a quick query. Not been using Scilab for a while, so
maybe I have missed something, but is there a built-in
precision setting for working with real and imaginary
functions?</div>
<div> </div>
<div>Tried the Euler formula (special case) in Scilab 5.4.1:</div>
<div> </div>
<div>-->x=cos(%pi)+(%i*sin(%pi))<br>
x =<br>
<br>
- 1. + 1.225D-16i <br>
<br>
-->y=%e^(%i*%pi)<br>
y =<br>
<br>
- 1. + 1.225D-16i </div>
<div> </div>
<div>The real part is fine, but the complex has a measured value
(approaching zero). Is there a way to tell Scilab if this gets
beyond a limit to round off at zero say?</div>
<div> </div>
<div>Sure this is an easy one!</div>
<div> </div>
<div>Cheers</div>
<div><br>
Lester</div>
</div>
<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>
<br>
<pre class="moz-signature" cols="72">--
Adrien Vogt-Schilb
PhD Student (Cired)</pre>
</body>
</html>