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