From:  Bob Smith <bsmith@sudleydeplacespam.com>
Date:  07 Jul 2019 05:50:30 Hong Kong Time
Newsgroup:  news.alt119.net/comp.lang.apl
Subject:  

Re: Possible bug Nars2000

NNTP-Posting-Host:  p83a029286261ecf7aa2a393b909719bd136aa75fd69e00eb.newsdawg.com

On 7/6/2019 4:15 PM, Rosario19 wrote:
> On Sat, 6 Jul 2019 14:58:32 -0400, Bob Smith wrote:
> 
>> On 7/6/2019 12:07 PM, J. Clarke wrote:
>>> On Sat, 06 Jul 2019 16:37:36 +0200, Rosario19 
>>> wrote:
>>>
>>>> On Sat, 06 Jul 2019 16:36:15 +0200, Rosario19 wrote:
>>>>
>>>> >from the Windows calculator:
>>>>> 2295655831212461065151424 / 1901165= 1207499523298851527,9586064334237
>>>>>
>>>> >from NARS2000 
>>>>> NARS2000 (Win32) Version # 0.5.5.1
>>>>>
>>>>>
>>>>> MPIR Version #3.0.0
>>>>> GMP Version #6.0.0
>>>>>
>>>>>         floor 2295655831212461065151424x ÷ 1901165x
>>>>> 1207499523298851528
>>>>>
>>>>> for me it should be 1207499523298851527
>>>>
>>>> where floor is the corrispondece character in the APL language
>>>
>>> Also occurs in 5.10.0.
>>>
>>> 'i' ?dc 2295655831212461065151424x ÷ 1901165x (where ? is quad)
>>> returns 1207499523298851527
>>
>> As it turns out these result are all correct.  The comparison with the
>> Windows calculator misses the fact that APL use Comparison Tolerance
>> (?CT) when comparing FP numbers (and NARS2000 also uses ?CT when
>> comparing MP Integer/Rational numbers).  The default value for ?CT in
>> NARS2000 is 3E¯15, and as the actual result of the division is
>> 1207499523298851527.958606433423716510666, the correct Floor of that
>> number within ?CT is 1207499523298851528.
>>
>> In order to obtain the same result as the Windows calculator:
>>
>>        ?CT?0
>>        ?2295655831212461065151424x ÷ 1901165x
>> 1207499523298851527
>>
>> You might ask, Why use ?CT when comparing MPIRs?  Some time ago I wrote
>> a paper on that topic which outlines the arguments pro and con.
> 
> i'am a beginner...
> the question for me was, if the type big rational it has NARS2000 can
> be a big integer...
> 
> i see + operation on big number exist,
> so - so * multiplication
> 
> what i did not find was division...
> than now i find it too (using division and APL floor for type
> rational) and so i could use rational as big integer...
> 
> if one has +-*/ operations, how for example C standard define on
> unsigned (so trucate division as C ecc) for me one can calculate all
> using big int...

Yes, you can calculate the truncated quotient in APL similar to how C 
calculates that quantity by setting ⎕CT to 0 as in ⎕CT←0.  After doing 
that, the Floor function in APL on the quotient should calculate the 
same answer as in C.

In more detail, the quotient of two big integers in NARS2000 is a big 
(Multi-Precision) Rational number as in

       2295655831212461065151424x ÷ 1901165x
2295655831212461065151424r1901165

Because the dividend and divisor have no factors in common, the quotient 
is represented as the Dividend (numerator) and Divisor (denominator) 
separated by the Rational number symbol 'r'.

As a decimal number this quotient is approximately 
1207499523298851527.958606433423716510666 whose Floor (with ⎕CT set to 
0) is 1207499523298851527 -- the same result you would get in C.

> Thank you very much
>   
>> Although the current implementation of NARS2000 happens to use ?CT when
>> comparing MPIRs, in my mind, that question is still unsettled.
>>
>> I would greatly appreciate any comments you all might have to help
>> settle it.
> 


-- 
_________________________________________
Bob Smith -- bsmith@sudleydeplacespam.com
http://www.sudleyplace.com - http://www.nars2000.org

To reply to me directly, delete "despam".