> From: Sherlock, Ric > > > From: Raul Miller > > > > On Thu, Oct 15, 2009 at 4:58 PM, Eldon Eller wrote: > > > NB. stdval R returns the standard 1% resistor value nearest R. > > > > > > stdval=.10&^...@c*100&nrnd@(10&^@(96&(nrnd=.([:%[)*[:<.0.5"_+*)@(log- > > c=.[:<.log=.10&^.))) > > > > > log=: 10&^. > nrnd0=: [ %~ 0.5 <....@+ * > stdval0=: <.&.log * 100 nrnd0 96 nrnd0 (- <.)&.log > (stdval -: stdval0) 0.012 0.01 5 3 2 > 0 > > This seems to: > log=: 10&^. > nrnd1=: %...@[ * 0.5 <....@+ * > stdval1=: (10&^@<. * 100 nrnd1 10 ^ 96 nrnd1 ] - <.)@log > (stdval -: stdval1) 0.012 0.01 5 3 2 > 1
Or using under (&.) as suggested by Raul stdval2=: (<.&.log * 100 nrnd1 (96 nrnd1 ] - <.)&.log) (stdval -: stdval2) 0.012 0.01 5 3 2 1 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
