No: integers do not automatically get converted to extended precision.

Integers simply have sufficient precision for this example.

Thanks,

-- 
Raul

On Fri, Sep 8, 2017 at 3:02 AM, Erling Hellenäs
<erl...@erlinghellenas.se> wrote:
> An integer is auto-converted to extended precision, but not to rational. Yet
> Residue seems to be defined for rationals.
>
>      n=.14
>
> (n^2x) |5729082486784839
>
> 147
>
>      3!:0 (n^2x)
>
> 64
>
>      3!:0 (n^2x) |5729082486784839
>
> 64
>
>
> /Erling
>
>
>
> Den 2017-09-08 kl. 03:19, skrev Don Kelly:
>>
>> Yet this works
>>
>> n=:14
>>
>> (n^2x) |5729082486784839
>>
>> 147
>>
>>
>> Don Kelly
>>
>> On 2017-09-07 11:40 AM, Erling Hellenäs wrote:
>>>
>>> Hi all !
>>>
>>> Case 1:
>>>     3!:0 [ (n^2)
>>>
>>> 8
>>>
>>>      (n^2) | 5729082486784839
>>>
>>> 0
>>>
>>> It is non-intuitive that an integer raised to an integer is a float, but
>>> I think it is normal. It would be possible with a performance penalty to get
>>> an integer result. One problem with that is that it would easily overflow.
>>> It would also be possible to have a special operation for this case.
>>> When the left argument is a float the right argument has to be converted
>>> to a float. It must be assumed that this conversion is intentional, even
>>> though it is implicit.
>>>
>>> Case 2:
>>>      3!:0 [ (n^2)
>>>
>>> 8
>>>
>>>      (n^2) | 5729082486784839x
>>>
>>> 0
>>>
>>> 3!:0 (n^2) | 5729082486784839x
>>>
>>> 8
>>>
>>> Here the rational seems to be converted to a float and the result is
>>> float. Shouldn't we have an error instead of converting rationals to float?
>>>
>>> Case 3:
>>>
>>> 3!:0 (x: n^2)
>>>
>>> 128
>>>
>>>      (x: n^2) | 5729082486784839
>>>
>>> 0
>>>
>>> 3!:0 (x: n^2) | 5729082486784839
>>>
>>> 128
>>>
>>> I have a hard time understanding what happens here. This result seems
>>> very peculiar. Is the left and right argument converted to float and the
>>> float result converted to rational?!
>>> Shouldn't we have an error instead of converting rationals to float?
>>> We could not have floats auto-converted to rationals?
>>> In this case the integer should be converted to rational and we should
>>> get a rational result?
>>>
>>> It is non-intuitive that (*: n) does not give the same result as (n^2).
>>> Maybe once this was decided because of performance reasons.
>>>
>>> Cheers,
>>>
>>> Erling Hellenäs
>>>
>>> On 2017-09-05 18:41, Rob B wrote:
>>>>
>>>> Could someone explain this please?
>>>>
>>>>   n=.14
>>>>     n
>>>> 14
>>>>     (*: n) | 5729082486784839
>>>> 147
>>>>     196 | 5729082486784839
>>>> 147
>>>>     (n^2) | 5729082486784839
>>>> 0
>>>>     (n^2) | 5729082486784839x
>>>> 0
>>>>     (x: n^2) | 5729082486784839
>>>> 0
>>>>     (x: n^2) | 5729082486784839x
>>>> 147
>>>>
>>>>
>>>> Regards, Rob Burns
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>
>>>
>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to