Re: [Bug-apl] Hang in Residue

2018-01-09 Thread Jay Foad
Sure: I would expect that the values I've highlighted in red below should
all be zero. The other results are all OK as far as I know, though I
haven't scrutinised them carefully. I'm just saying that GNU APL doesn't
seem to be following this particular rule from the ISO standard: "If Z is A
, return zero."

  ⎕CT←0
  A←(-⌽A),0,A←1e¯200 1e¯100 1 1e100 1e200
  A∘.|A
 0E0   ¯1E100 ¯1E0   ¯1E¯100 ¯1E¯200 0 0E00E0¯1E200 0E0   0E0
 0E00E0   ¯1E0   ¯1E¯100 ¯1E¯200 0 0E00E0¯1E100 0E0   0E0
 0E00E00E0   ¯1E¯100 ¯1E¯200 0 0E00E0 0E0   0E0   0E0
 0E00E00E00E0¯1E¯200 0 0E00E0 0E0   0E0   0E0
 0E00E00E00E0 0E00 0E00E0 0E0   0E0   0E0
¯1E200 ¯1E100 ¯1E0   ¯1E¯100 ¯1E¯200 0 1E¯200 1E¯100  1E0   1E100 1E200
 0E00E00E00E0 0E00 0E00E0 0E0   0E0   0E0
 0E00E00E00E0 0E00 1E¯200 0E0 0E0   0E0   0E0
 0E00E00E00E0 0E00 1E¯200 1E¯100  0E0   0E0   0E0
 0E00E01E100  0E0 0E00 1E¯200 1E¯100  1E0   0E0   0E0
 0E00E01E200  0E0 0E00 1E¯200 1E¯100  1E0   1E100 0E0

Jay.

On 8 January 2018 at 21:13, Juergen Sauermann  wrote:

> Hi Jay,
>
> I am still puzzled by the ISO description (and can't find the "IEEE
> standard for Binary Floating-Point Arithmetic (754)"
> referenced in the standard.
>
> Would you be able to provide the expected expected output of your example
> below?
>
> If I follow the ISO description of mod in the ISO APL standard word by
> word then I am getting pretty odd values at times.
>
> Best Regards,
> /// Jürgen
>
>
> On 01/08/2018 02:19 PM, Jay Foad wrote:
>
> Yes, thanks! Now, when ⎕CT=0 there are some odd results:
>
>   ⎕CT←0
>   A←(-⌽A),0,A←1e¯200 1e¯100 1 1e100 1e200
>   A∘.|A
>  0E0   ¯1E100 ¯1E0   ¯1E¯100 ¯1E¯200 0 0E00E0¯1E200 0E0   0E0
>  0E00E0   ¯1E0   ¯1E¯100 ¯1E¯200 0 0E00E0¯1E100 0E0   0E0
>  0E00E00E0   ¯1E¯100 ¯1E¯200 0 0E00E0 0E0   0E0   0E0
>  0E00E00E00E0¯1E¯200 0 0E00E0 0E0   0E0   0E0
>  0E00E00E00E0 0E00 0E00E0 0E0   0E0   0E0
> ¯1E200 ¯1E100 ¯1E0   ¯1E¯100 ¯1E¯200 0 1E¯200 1E¯100  1E0   1E100 1E200
>  0E00E00E00E0 0E00 0E00E0 0E0   0E0   0E0
>  0E00E00E00E0 0E00 1E¯200 0E0 0E0   0E0   0E0
>  0E00E00E00E0 0E00 1E¯200 1E¯100  0E0   0E0   0E0
>  0E00E01E100  0E0 0E00 1E¯200 1E¯100  1E0   0E0   0E0
>  0E00E01E200  0E0 0E00 1E¯200 1E¯100  1E0   1E100 0E0
>   1e200|¯1
> 1E200
>
> The standard explicitly says that the result should never be the same as
> the (non-zero) left argument: "If Z is A , return zero."
>
> Jay.
>
> On 8 January 2018 at 12:26, Juergen Sauermann <
> juergen.sauerm...@t-online.de> wrote:
>
>> Hi Jay,
>>
>> maybe *SVN 1036* works better.
>>
>> /// Jürgen
>>
>>
>> On 01/08/2018 01:02 PM, Jay Foad wrote:
>>
>> Thanks. With r1035 I get:
>>
>>   A←(-⌽A),0,A←1e¯200 1e¯100 1 1e100 1e200
>>   A∘.|A
>>  0E00E00  0E0 0E00 0E00E00 0E0   0E0
>>  0E00E00  0E0 0E00 0E00E00 0E0   0E0
>>  0E00E00  0E0 0E00 0E00E00 0E0   0E0
>>  0E00E00  0E0 0E00 0E00E00 0E0   0E0
>> ¯1E200  0E00  0E0 0E00 0E00E00 0E0   0E0
>> ¯1E200 ¯1E100 ¯1 ¯1E¯100 ¯1E¯200 0 1E¯200 1E¯100 1 1E100 1E200
>>  0E00E00  0E0 0E00 0E00E00 0E0   0E0
>>  0E00E00  0E0 0E00 0E00E00 0E0   0E0
>>  0E00E00  0E0 0E00 0E00E00 0E0   0E0
>>  0E00E00  0E0 0E00 0E00E00 0E0   0E0
>>  0E00E00  0E0 0E00 0E00E00 0E0   0E0
>>
>> One result stands out:
>>
>>   ¯1E¯200|¯1E200
>> ¯1E200
>>
>> The result of A|B (with A non-zero) should be strictly smaller in
>> magnitude than A, so this seems very wrong.
>>
>> Jay.
>>
>>
>> On 8 January 2018 at 11:49, Juergen Sauermann <
>> juergen.sauerm...@t-online.de> wrote:
>>
>>> Hi Jay,
>>>
>>> thanks, fixed in *SVN 1035*.
>>>
>>> BTW tryapl.com gives this:
>>>
>>> *  A←1E¯200 1E200  ¯1E¯200 ¯1E200*
>>>
>>> *  A ∘.∣ A*
>>>
>>> *0 0 0 0
>>> 0 0 0 0
>>> 0 0 0 0
>>> 0 0 0 0*
>>> /// Jürgen
>>>
>>>
>>>
>>> TOn 01/08/2018 10:29 AM, Jay Foad wrote:
>>>
>>> Thanks. At r1034 I get:
>>>
>>>   A←(-⌽A),0,A←1e¯200 1e¯100 1 1e100 1e200
>>>   A∘.|A
>>> DOMAIN ERROR
>>>
>>> And here's one of the cases that fails:
>>>
>>>   1e¯200|1e200
>>> DOMAIN ERROR
>>>
>>> This still seems wrong to me, since the ISO standard for Residue says
>>> "Implementations should avoid signalling limit-error in residue" with
>>> advice on how to avoid it. (OK, it doesn't mention DOMAIN ERROR, but I
>>> think the same principle applies.)
>>>
>>> Jay.
>>>
>>>
>>> On 6 January 2018 at 11:56, Juergen Sauermann <
>>> juergen.sauerm...@t-online.de> wrote:
>>>
 Hi,

 thanks, fixed in *

Re: [Bug-apl] Hang in Residue

2018-01-09 Thread Juergen Sauermann

  
  
Hi Jay,
  
  I've done a complete rework of the residue function for real
  arguments.
  The implementation follows the ISO standard almost literally. SVN
1037.
  
  /// Jürgen
  

On 01/08/2018 02:19 PM, Jay Foad wrote:


  Yes, thanks! Now, when ⎕CT=0 there are some odd
results:



        ⎕CT←0
        A←(-⌽A),0,A←1e¯200 1e¯100 1 1e100 1e200
        A∘.|A
   0E0   ¯1E100 ¯1E0   ¯1E¯100 ¯1E¯200 0 0E0    0E0  
 ¯1E200 0E0   0E0
   0E0    0E0   ¯1E0   ¯1E¯100 ¯1E¯200 0 0E0    0E0  
 ¯1E100 0E0   0E0
   0E0    0E0    0E0   ¯1E¯100 ¯1E¯200 0 0E0    0E0     0E0
  0E0   0E0
   0E0    0E0    0E0    0E0    ¯1E¯200 0 0E0    0E0     0E0
  0E0   0E0
   0E0    0E0    0E0    0E0     0E0    0 0E0    0E0     0E0
  0E0   0E0
  ¯1E200 ¯1E100 ¯1E0   ¯1E¯100 ¯1E¯200 0 1E¯200 1E¯100  1E0
  1E100 1E200
   0E0    0E0    0E0    0E0     0E0    0 0E0    0E0     0E0
  0E0   0E0
   0E0    0E0    0E0    0E0     0E0    0 1E¯200 0E0     0E0
  0E0   0E0
   0E0    0E0    0E0    0E0     0E0    0 1E¯200 1E¯100  0E0
  0E0   0E0
   0E0    0E0    1E100  0E0     0E0    0 1E¯200 1E¯100  1E0
  0E0   0E0
   0E0    0E0    1E200  0E0     0E0    0 1E¯200 1E¯100  1E0
  1E100 0E0


        1e200|¯1
  1E200



The standard explicitly says that the result should never
  be the same as the (non-zero) left argument: "If Z is A ,
  return zero."


Jay.
  
  
On 8 January 2018 at 12:26, Juergen
  Sauermann 
  wrote:
  
 Hi Jay,

maybe SVN 1036 works better.

/// Jürgen

  
  

  On
01/08/2018 01:02 PM, Jay Foad wrote:
  
  
Thanks. With r1035 I get:
  
  
  
      A←(-⌽A),0,A←1e¯200 1e¯100 1 1e100
  1e200
      A∘.|A
 0E0    0E0    0  0E0     0E0    0 0E0  
   0E0    0 0E0   0E0
 0E0    0E0    0  0E0     0E0    0 0E0  
   0E0    0 0E0   0E0
 0E0    0E0    0  0E0     0E0    0 0E0  
   0E0    0 0E0   0E0
 0E0    0E0    0  0E0     0E0    0 0E0  
   0E0    0 0E0   0E0
¯1E200  0E0    0  0E0     0E0    0 0E0  
   0E0    0 0E0   0E0
¯1E200 ¯1E100 ¯1 ¯1E¯100 ¯1E¯200 0 1E¯200
  1E¯100 1 1E100 1E200
 0E0    0E0    0  0E0     0E0    0 0E0  
   0E0    0 0E0   0E0
 0E0    0E0    0  0E0     0E0    0 0E0  
   0E0    0 0E0   0E0
 0E0    0E0    0  0E0     0E0    0 0E0  
   0E0    0 0E0   0E0
 0E0    0E0    0  0E0     0E0    0 0E0  
   0E0    0 0E0   0E0
 0E0    0E0    0  0E0     0E0    0 0E0  
   0E0    0 0E0   0E0
  
  
  
  One result stands out:
  
  
  
      ¯1E¯200|¯1E200
¯1E200
  
  
  
  The result of A|B (with A non-zero) should be
strictly smaller in magnitude than A, so this
seems very wrong.
  
  
  Jay.
  
  


  On 8 January 2018 at
11:49, Juergen Sauermann 
wrote:

   Hi
  Jay,
  
  thanks, fixed in SVN 1035.
  
  BTW tryapl.com
  gives this:

  A←1E¯200 1E200  ¯1E¯200 ¯1E200

  A ∘.∣ A

0 0 0 0
0 0 0 0
0 0 0 0
0