Discussion:
[Bug-apl] Integer - rational multiplication anomaly
Frederick Pitts
2017-08-16 04:55:21 UTC
Permalink
Hello all,

With gnu-apl configured with RATIONAL_NUMBERS_WANTED=YES, I
observe the following:

⎕PS ← 1 22
x ← 3 ÷ 1
x + 1 ÷ 2
╔═══╗
║7÷2║
╚═══╝
x × 1 ÷ 2
╔═══╗
║1.5║
╚═══╝

The last result should be 3÷2. In general, multiplication of
integers and rationals should yield rationals or integers (which are
rationals with a denominator of 1), not floats. The exception would be
when the numerator or denominator of an intermediate rational result
overflows the integer range.

Regards,

Fred
Juergen Sauermann
2017-08-16 11:53:37 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 Frederick,<br>
<br>
thanks, fixed in <b>SVN 996</b>.<br>
<br>
/// Jürgen<br>
<br>
</font><br>
<div class="moz-cite-prefix">On 08/16/2017 06:55 AM, Frederick Pitts
wrote:<br>
</div>
<blockquote cite="mid:***@comcast.net"
type="cite">
<pre wrap="">Hello all,

With gnu-apl configured with RATIONAL_NUMBERS_WANTED=YES, I
observe the following:

⎕PS ← 1 22
x ← 3 ÷ 1
x + 1 ÷ 2
╔═══╗
║7÷2║
╚═══╝
x × 1 ÷ 2
╔═══╗
║1.5║
╚═══╝

The last result should be 3÷2. In general, multiplication of
integers and rationals should yield rationals or integers (which are
rationals with a denominator of 1), not floats. The exception would be
when the numerator or denominator of an intermediate rational result
overflows the integer range.

Regards,

Fred


</pre>
</blockquote>
<br>
</body>
</html>

Continue reading on narkive:
Search results for '[Bug-apl] Integer - rational multiplication anomaly' (Questions and Answers)
10
replies
Doesn't this logic prove that 0.999 = 1?
started 2011-05-07 16:04:15 UTC
polls & surveys
Loading...