[Jprogramming] Puzzling result

Rob B rb75app at me.com
Thu Sep 7 08:42:55 UTC 2017


On reflection my real question is; should mod suddenly and without warning give the wrong answer when a number gets suffiently large? I have been caught by this many times. The incorrect answer zero is problematic as it suggests divisibility. 

Apologies if this has all been discussed before.

Regards, Rob Burns.



> On 6 Sep 2017, at 09:11, Rob B <rb75app at icloud.com> wrote:
> 
> Thanks, 
> 
> I now see it's reasonable for ^ to convert to flost and *: to remain exact.
> 
> The other discrepancy is probably due to my old version, iPad 701.
> 
> Regards, Rob Burns.
> 
>> On 5 Sep 2017, at 17:48, HenryRich <henryhrich at gmail.com> wrote:
>> 
>>  datatype 47^2
>> 
>> floating
>> 
>> 
>> So
>> 
>> (n^2) | 5729082486784839
>> 
>> is promoted to float, and loses precision.  Same when the big number is extended - it's converted to float.
>> 
>> For
>> 
>>  (x: n^2) | 5729082486784839
>> 
>> I get 147 as the result.
>> 
>> Henry Rich
>> 
>>> On 9/5/2017 12:41 PM, 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


More information about the Programming mailing list