<.y and >.y on floating point arguments in the range of integers have been made leaner and slightly faster.
y=: 10000 * _0.5 + 1e6 [EMAIL PROTECTED] 0 ts=: 6!:2 , 7!:[EMAIL PROTECTED] NB. J6.02x ts '<.y' 0.125669 4.19488e6 NB. J6.01 ts '<.y' 0.135530 1.25835e7 ----- Original Message ----- From: Roger Hui <[EMAIL PROTECTED]> Date: Monday, February 12, 2007 10:00 pm Subject: Re: [Jgeneral] large space overhead > I have looked further into the matter. > > y=: 1000 * 1e6 [EMAIL PROTECTED] 0 > 7!:2 '<.y' > 12583552 > > One expects that it should take 4 bytes per > element but it takes more than 8. The problem > is that <.y uses an intermediate result which > is float and then converts it into integers > if possible, to accommodate cases like <.1e20 . > So in the cases > > integer <.@:* float > integer <.@ * float > > the problem lies in the monad <. . In contrast, > > integer <[EMAIL PROTECTED] integer > > does not suffer from this problem because the > entire operation can be done internally using > integer operations. > > A way to improve the monad <. (and >.) is to > assume that the final result is all integers, > expected to be by far the most common case, > and handle the case where the result must be > floats as an exception. We will see after this > is done whether it is worthwhile to implement > integer <[EMAIL PROTECTED] float in special code. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
