Hum.... more observations:
(-:!.0 <.) 2x ^. 2x^47
0
(-:!.0 <.) 2x ^. <: 2x^47
0
(-:!.0 <.) 2x ^. 2x^48
1
(-:!.0 <.) 2x ^. <: 2x^48
1
for any y, 2x ^. 2x^y should always return 1 and
2x ^. <: 2x ^ y should always return 0
isinteger 2x ^. 2x ^ y works properly for all y less-than 40
for y greater than or equal to 40,
isinteger 2x *. 2x ^ y fails.
----- Original Message Follows -----
From: [email protected]
To: Programming forum <[email protected]>
Subject: Re: [Jprogramming] question on using ^ and ^.
Date: Mon, 15 Jun 2009 07:36:17 -0800
>Hum.....
>
> (-:!.0 <.) 2x ^. 2x^607
>
>0
> (-:!.0 <.) 2x ^. <: 2x^607
>
>0
>
>Using isinteger returns boolean 1 in both the above cases.
>
>Another integesting observation is:
>
> (-:!.0 <.) 2x ^. 2x^100
>
>1
> (-:!.0 <.) 2x ^. 2x^101
>
>0
>
>
>----- Original Message Follows -----
>From: "Sherlock, Ric" <[email protected]>
>To: Programming forum <[email protected]>
>Subject: Re: [Jprogramming] question on using ^ and ^.
>Date: Mon, 15 Jun 2009 10:47:06 +1200
>
>>> From: [email protected]
>>>
>>> isinteger 2x ^. 2x^607
>>> 1
>>> isinteger 2x ^. <: 2x^607
>>> 1
>>>
>>> The last one I executed should return 0, not 1
>>>
>>> Any thoughts?
>>
>>This is because match (-:) does a tolerant comparison by
>>default. See the dictionary page for match.
>>
>>For non-tolerant comparison you can use:
>>
>> (-:!.0 <.) 2x ^. <: 2x^16
>>0
>>
>>See also:
>>"http://www.jsoftware.com/jwiki/Essays/Absolute and
>>Relative Tolerance"
>>"http://www.jsoftware.com/jwiki/Essays/Tolerant
>>Comparison"
>>
>>----------------------------------------------------------
>>- ----------- 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