>   NB. there must be some optimisation here?!
>   ts'(**<.@:**)(100000$i:5)--:ct'
> 0.0108771 3.67232e6

There are no optimizations.  The expression is fast
because it avoids the most expensive operation
executed by the other expressions -- the monad <. 
on floats.

BTW, the result of the expression is a float and
is not necessarily an exact integer:

   ] b=: (**<.@:**) 5+-:ct
5
   b-5
2.84217e_14



----- Original Message -----
From: Mike Day <[EMAIL PROTECTED]>
Date: Monday, October 23, 2006 11:12 am
Subject: Re: [Jprogramming] fuzzy <.0

> ... but the timings aren't so good - perhaps that
> doesn't matter.
> 
>   ts'<.`0:@.(0=*)("0) (1000000$i:5)--:ct'
> 0.995482 5.82e7
> 
>   NB. similar avoiding the "0 test: 
>   ts'(<.*0:~:*) (1000000$i:5)--:ct'
> 0.279156 3.04111e7
> 
>   NB. there must be some optimisation here?!
>   ts'(**<.@:**)(100000$i:5)--:ct'
> 0.0108771 3.67232e6
> M
> 
> bill lam wrote:
> > bill lam wrote:
> >   
> >> I also try <.`0:@.(1:=>:)("0)
> >>     
> >
> > another candidate may be <.`0:@.(0:=*)("0) as monad * is 
> tolerant when comparing
> > with 0.


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

Reply via email to