[Scilab-users] Whay False
Rafael Guerra
jrafaelbguerra at hotmail.com
Tue Aug 23 14:20:53 CEST 2016
Hi Paul,
Note that reel-0.05 = -1.804D-16 not zero.
You need to use error bars to test equality of reals, ex: if abs(reel-0.05)< %eps (or <N*%eps)
Regards,
Rafael
From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Carrico, Paul
Sent: Tuesday, August 23, 2016 1:56 PM
To: International users mailing list for Scilab. (users at lists.scilab.org) <users at lists.scilab.org>
Subject: [Scilab-users] Whay False
Hi All,
I spent a lot of time in looking for an issue in my code ; finally I found the origin but I do not understand why ... probably a very basic reason :|
Any suggestion regarding the code here after ?
Thanks
Paul
#########################################################
mode(0)
a = 2.05
entier = int(a)
reel = modulo(a,2)
if ( reel == 0.05) then
chaine = '05'
elseif (reel == 0.5) then
chaine = '50'
else
chaine = '00'
end
printf("chaine = %s\n',chaine)
// Nota
reel == 0.05 // whay False ?????
EXPORT CONTROL :
Cet email ne contient pas de données techniques
This email does not contain technical data
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160823/0a5ea239/attachment.htm>
More information about the users
mailing list