Discussion:
[Bug-apl] Overflow in LCM
Kacper Gutowski
2017-04-20 04:05:17 UTC
Permalink
Hi,
There are overflows in least common multiple function:

2028259601 ∧ 9094863431
¯585
2028259601 ∧ 9094863431.0
¯585
2028259601 ∧ 9094863431J0
¯1.844674407E19


-k
Juergen Sauermann
2017-04-20 15:42:25 UTC
Permalink
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="Helvetica, Arial, sans-serif">Hi Kacper,<br>
<br>
thanks, fixed in <b>SVN 926</b>.<br>
<br>
I believe that the last example is not an overflow but the proper
result.<br>
At least tryapl.org says so.<br>
<br>
/// Jürgen<br>
<br>
</font><br>
<div class="moz-cite-prefix">On 04/20/2017 06:05 AM, Kacper Gutowski
wrote:<br>
</div>
<blockquote
cite="mid:***@hyper.mwgamera.name"
type="cite">
<pre wrap="">Hi,
There are overflows in least common multiple function:

2028259601 ∧ 9094863431
¯585
2028259601 ∧ 9094863431.0
¯585
2028259601 ∧ 9094863431J0
¯1.844674407E19


-k


</pre>
</blockquote>
<br>
</body>
</html>
Kacper Gutowski
2017-04-20 16:23:36 UTC
Permalink
thanks, fixed in SVN 926.
I believe that the last example is not an overflow but the proper result.
At least tryapl.org says so.
Thanks.
I think the last one also should be positive. Tryapl says so too.

-k
Juergen Sauermann
2017-04-20 16:43:03 UTC
Permalink
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="Helvetica, Arial, sans-serif">Hi Kacper,<br>
<br>
maybe, but the ISO standard says (function And/LCM on page 93) :<br>
<br>
<font face="Courier New, Courier, monospace"><b>      ¯29J53 </b><b>∧</b><b>
¯1J107</b><b><br>
</b><b>¯853J¯329</b></font><br>
</font><br>
So the question is: what are the rules for setting the sign of the
result?<br>
No rules in ISO, no rules in APL2 either.<br>
<br>
Strictly speaking, if <b>X</b> is some least common multiple then <b>-X</b>
is also a common multiple<br>
(I believe least refers the magnitude of the LCM, otherwise the ISO
example would be wrong).<br>
<br>
Confused,<br>
/// Jürgen<br>
<br>
<br>
<div class="moz-cite-prefix">On 04/20/2017 06:23 PM, Kacper Gutowski
wrote:<br>
</div>
<blockquote cite="mid:***@gmail.com"
type="cite">
<pre wrap="">On Thu, Apr 20, 2017 at 05:42:25PM +0200, Juergen Sauermann wrote:
</pre>
<blockquote type="cite">
<pre wrap="">thanks, fixed in SVN 926.

I believe that the last example is not an overflow but the proper result.
At least tryapl.org says so.
</pre>
</blockquote>
<pre wrap="">
Thanks.
I think the last one also should be positive. Tryapl says so too.

-k

</pre>
</blockquote>
<br>
</body>
</html>
Louis de Forcrand
2017-04-21 07:48:28 UTC
Permalink
The last one (at least IMO) should be positive and equal to the (correct) result of the first of the three examples, because
9094863431 = 9094863431J0

Cheers,
Louis
Post by Juergen Sauermann
Hi Kacper,
¯29J53 ∧ ¯1J107
¯853J¯329
So the question is: what are the rules for setting the sign of the result?
No rules in ISO, no rules in APL2 either.
Strictly speaking, if X is some least common multiple then -X is also a common multiple
(I believe least refers the magnitude of the LCM, otherwise the ISO example would be wrong).
Confused,
/// JÃŒrgen
Post by Kacper Gutowski
thanks, fixed in SVN 926.
I believe that the last example is not an overflow but the proper result.
At least tryapl.org says so.
Thanks.
I think the last one also should be positive. Tryapl says so too.
-k
Juergen Sauermann
2017-04-21 13:03:25 UTC
Permalink
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="Helvetica, Arial, sans-serif">Hi Louis,<br>
<br>
I see. I overlooked that the first and third example were similar.<br>
Fixed in <b>SVN 927</b>.<br>
<br>
</font>/// Jürgen<br>
<br>
<br>
<div class="moz-cite-prefix">On 04/21/2017 09:48 AM, Louis de
Forcrand wrote:<br>
</div>
<blockquote
cite="mid:FEAE2B84-6E44-4E9D-A345-***@bluewin.ch"
type="cite">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<div><span></span></div>
<div>
<meta http-equiv="content-type" content="text/html;
charset=utf-8">
<div>The last one (at least IMO) should be positive and equal to
the (correct) result of the first of the three examples,
because</div>
<div id="AppleMailSignature"><span style="background-color:
rgba(255, 255, 255, 0);">9094863431 = 9094863431J0</span></div>
<div id="AppleMailSignature"><br>
Cheers,</div>
<div id="AppleMailSignature">Louis</div>
<div><br>
On 20 Apr 2017, at 18:43, Juergen Sauermann &lt;<a
moz-do-not-send="true"
href="mailto:***@t-online.de">***@t-online.de</a>&gt;
wrote:<br>
<br>
</div>
<blockquote type="cite">
<div>
<meta content="text/html; charset=utf-8"
http-equiv="Content-Type">
<font face="Helvetica, Arial, sans-serif">Hi Kacper,<br>
<br>
maybe, but the ISO standard says (function And/LCM on page
93) :<br>
<br>
<font face="Courier New, Courier, monospace"><b>     
¯29J53 </b><b>∧</b><b> ¯1J107</b><b><br>
</b><b>¯853J¯329</b></font><br>
</font><br>
So the question is: what are the rules for setting the sign
of the result?<br>
No rules in ISO, no rules in APL2 either.<br>
<br>
Strictly speaking, if <b>X</b> is some least common
multiple then <b>-X</b> is also a common multiple<br>
(I believe least refers the magnitude of the LCM, otherwise
the ISO example would be wrong).<br>
<br>
Confused,<br>
/// Jürgen<br>
<br>
<br>
<div class="moz-cite-prefix">On 04/20/2017 06:23 PM, Kacper
Gutowski wrote:<br>
</div>
<blockquote
cite="mid:***@gmail.com"
type="cite">
<pre wrap="">On Thu, Apr 20, 2017 at 05:42:25PM +0200, Juergen Sauermann wrote:
</pre>
<blockquote type="cite">
<pre wrap="">thanks, fixed in SVN 926.

I believe that the last example is not an overflow but the proper result.
At least <a moz-do-not-send="true" href="http://tryapl.org">tryapl.org</a> says so.
</pre>
</blockquote>
<pre wrap="">Thanks.
I think the last one also should be positive. Tryapl says so too.

-k

</pre>
</blockquote>
<br>
</div>
</blockquote>
</div>
</blockquote>
<br>
</body>
</html>
Leslie S Satenstein
2017-04-26 16:36:48 UTC
Permalink
Hi Kacper
I am getting different values for some of the calculations that you get and some that compare.  

I too am on Fedora 25, with C/CPP compiler GCC 6.3
I do not have access at this moment to GCC 7.x  and I suspect that the errors may not be in gnu-apl code, but with what the compiler produces.  Compiler optimization may be the culprit.

 Regards
 Leslie
Leslie Satenstein
Montréal Québec, Canada



From: Kacper Gutowski <***@gmail.com>
To: bug-***@gnu.org
Sent: Thursday, April 20, 2017 12:05 AM
Subject: [Bug-apl] Overflow in LCM

Hi,
There are overflows in least common multiple function:

      2028259601 ∧ 9094863431
¯585
      2028259601 ∧ 9094863431.0
¯585
      2028259601 ∧ 9094863431J0
¯1.844674407E19


-k

Loading...