<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hello,<br>
<br>
Le 19/09/2017 à 11:16, Pinçon Bruno a écrit :<br>
</div>
<blockquote
cite="mid:07f17707-c57d-50fa-d6fe-ba7196278fea@univ-lorraine.fr"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<div class="moz-cite-prefix">Le 18/09/2017 à 20:54, Samuel Gougeon
a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:03a6b389-083a-0dad-b6ab-b8a9a29ecf44@free.fr">
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
<br>
<p> Now comes the issue:<br>
In (A), the relative difference 1/2^53 is too small (<
%eps) to be recorded and to change the number. OK.<br>
Since 1 / (2^53 +2) is even smaller than 1 / (2^53), it should
nor make a difference. Yet, it does:</p>
<p><tt>--> (2^53 + 2^1) + 1 == (2^53 + 2^1)</tt><tt><br>
</tt><tt> ans =</tt><tt><br>
</tt><tt> F</tt><tt><br>
</tt><br>
How is this possible ??!</p>
</blockquote>
<br>
<font size="+1"> <tt> </tt><tt>Hi all, </tt><tt><br>
</tt><tt><br>
</tt><tt> no issue here but</tt> <tt>s</tt><tt>imply the
round to even rule. Every real number<br>
should be approximated by the nearest floating point number
but in case of<br>
a number exactly between 2 successive floats the one with an
even end<br>
digit win. You can see this rule as a mean to approximate
those ambiguous cases,<br>
one in two down and one in two up, but has more subtle
features in it such<br>
(it is explained in Knuth I). <br>
<br>
<br>
OK that</tt><tt> </tt></font><tt><font size="+1">2^53 + 2^1
is exactly represented<br>
(it is a double float number). When computing : <br>
<br>
</font></tt><tt><tt> x = (2^53 + 2^1) + 1<br>
<br>
it is not a float but is exactly at the same distance
between the two floats :<br>
<br>
</tt></tt><tt><tt>2^53 + 2^1 and </tt></tt><tt><tt>2^53
+ 2^2 but this last one ends with a even digit (0)<br>
so : </tt></tt><br>
<tt><tt><tt><tt> fl( (2^53 + 2^1) + 1) = </tt></tt></tt></tt><tt><tt><tt><tt><tt><tt>2^53
+ 2^2<br>
<br>
hth<br>
Bruno<br>
</tt></tt></tt></tt></tt></tt></blockquote>
<br>
<tt>Thank you Bruno for this explanation and confirmation!<br>
Up to before, i was naively considering that all what is smaller
than %eps<br>
is ignored. But it is not the case. This rounding rule has some
somewhat<br>
puzzling side effects, since as initially illustrated, it leads to
sometimes<br>
take into account some relative quantities smaller than some other
ones that<br>
are ignored...<br>
<br>
So, i guess that whether this algorithm has been chosen, it shall
have more<br>
advantages than this kind of pitfall.<br>
<br>
Afterwards, i had a look to the Scilab %eps and number_properties
help pages:<br>
<a class="moz-txt-link-freetext" href="https://help.scilab.org/docs/6.0.0/en_US/percenteps.html">https://help.scilab.org/docs/6.0.0/en_US/percenteps.html</a><br>
<a class="moz-txt-link-freetext" href="https://help.scilab.org/docs/6.0.0/en_US/number_properties.html">https://help.scilab.org/docs/6.0.0/en_US/number_properties.html</a><br>
The IEEE 754 standard is quoted. Digging about it, for instance in<br>
<a class="moz-txt-link-freetext" href="https://en.wikipedia.org/wiki/IEEE_754">https://en.wikipedia.org/wiki/IEEE_754</a><br>
<a class="moz-txt-link-freetext" href="https://fr.wikipedia.org/wiki/IEEE_754">https://fr.wikipedia.org/wiki/IEEE_754</a><br>
is very instructive. There is a whole section about rounding
methodS.<br>
<br>
Le 19/09/2017 à 12:08, antoine monmayrant a écrit :<br>
> PS: Samuel, do you think you could close the bug by pointing
to this "round to even" rule?<br>
<br>
I am keeping open and updating the report. IMO the posted %eps
"exception" would deserve being documented as an example, either
in the %eps or the number_properties page. Moreover,
cross-references are missing between both pages. Finally, an
external pointer to IEEE 754 would be welcome.<br>
I will propose a revision.<br>
<br>
Again thanks for your answers.<br>
Best regards<br>
Samuel<br>
<br>
</tt>
</body>
</html>