Zsbán Ambrus schreef:
>> verbs like these will also work:
>>
>>           d0f0=: 1 +  <[EMAIL PROTECTED]&x:
>>           d0f1=: 1 + (<[EMAIL PROTECTED] x:)
>
> Thanks, those do seem to work.
>
Try this (extending input range):

   (2+i.50) -: 10 d0f0 10*^:(<50)10
0
   (2+i.50) -: 10 d0f0 10*^:(<50)10x
1

   (1+i.50) -: 10 d0f0 _1+10^1+i.50x
1
   (1+i.50) -: 10 d0f0 _1+10^1+i.50
0

It seems that all the proposed verbs produce wrong values
for some input values, unless you provide some of them with
ext. prec. input values. Even build in ext. prec. (d0fx)
doesn't seem to work.

Another verb proposed by Dan using different input values:

with zero tolerance:

   (2+i.50)-: 10(#@:(#.^:_1:!.0))"0[10*^:(<50)10x
1
   (2+i.50)-: 10(#@:(#.^:_1:!.0))"0[10*^:(<50)10
0

   (1+i.50)-: 10(#@:(#.^:_1:!.0))"0[_1+10^1+i.50
0
   (1+i.50)-: 10(#@:(#.^:_1:!.0))"0[_1+10^1+i.50x
1

without z.t.:

   (2+i.50)-: 10(#@:(#.^:_1))"0[10*^:(<50)10x
1
   (2+i.50)-: 10(#@:(#.^:_1))"0[10*^:(<50)10
1

   (1+i.50)-: 10(#@:(#.^:_1))"0[_1+10^1+i.50
0
   (1+i.50)-: 10(#@:(#.^:_1))"0[_1+10^1+i.50x
1


Simplifying d0f0:
  d0f017=:1 + <[EMAIL PROTECTED]

   (1+i.50) -: 10 d0f017 _1+10^1+i.50
0
   (1+i.50) -: 10 d0f017 _1+10^1+i.50x
1

   (2+i.50) -: 10 d0f017 10*^:(<50)10x
1
   (2+i.50) -: 10 d0f017 10*^:(<50)10
1


Conclusion: if not sure, use ext. prec. input values
and the most simple (?) verb d0f017.

Important for me in all this is, how to proof in advance
that the verb is correct for all input values, or saying
it's correct for a limited range of values.


=@@i

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to