] ct=: 2^_44
5.68434e_14
f=: <. * 0~:*
f (i:5)+-:ct
_5 _4 _3 _2 _1 0 1 2 3 4 5
f 0.5+(i:5)+-:ct
_5 _4 _3 _2 _1 0 1 2 3 4 5
----- Original Message -----
From: bill lam <[EMAIL PROTECTED]>
Date: Monday, October 23, 2006 8:49 am
Subject: Re: [Jprogramming] fuzzy <.0
> Mike,
>
> I think the absolute and signum method will floor towards to
> origin from both
> sides, this definitely useful when dealing with debit/credit numbers.
>
> (**<.@|)0.5+(i:5)+-:ct
> _4 _3 _2 _1 0 0 1 2 3 4 5
> (**<.@|)0.5+(i:5)--:ct
> _4 _3 _2 _1 0 0 1 2 3 4 5
> (**<[EMAIL PROTECTED]) 0.5+(i:5)+-:ct NB. this fail
> _4.5 _3.5 _2.5 _1.5 _0.5 0.5 1.5 2.5 3.5 4.5 5.5
>
> I also try <.`0:@.(1:=>:)("0)
> <.`0:@.(1:=>:)("0)(i:5)+-:ct
> _5 _4 _3 _2 _1 0 1 2 3 4 5
> <.`0:@.(1:=>:)("0)(i:5)--:ct
> _5 _4 _3 _2 _1 0 1 2 3 4 5
> <.`0:@.(1:=>:)("0)0.5+(i:5)+-:ct
> _5 _4 _3 _2 _1 0 1 2 3 4 5
> <.`0:@.(1:=>:)("0)0.5+(i:5)--:ct
> _5 _4 _3 _2 _1 0 1 2 3 4 5
>
> 1=1+x when x=0 tolerantly, but I'm not sure if there are other
> sufficientlylarge numbers that also satisfied the equality so that
> the idiom will fail.
>
> I wish J can do <.0 tolerantly. Does anyone know how the other APL
> interpretersbehave for <.0 ?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm