r=: <:10000x^30103
   NB.t=: <:2x^400000                                NB. t and r have similar 
magnitude
   t=: _48 #.\&.|. 400000#1                          NB. base 2^48 
representation

   M=: <.2^48
   xa=: {{ (] (1&|.@] + [ - M * ]) >:&M)^:_ x+y }}   NB. extended int add, 
assuming padded parameters

   '+~r' %&timex 'xa~t'
2.71429
   NB. 2.7x faster than the builtin extended-precision numbers!

   s=: 1,~0#~<:#t
   '+~r' %&timex 's xa t'                            NB. pathological case
0.00151854

   (+~<:2x^400000) = ([ + (<.2^48) * ])/ x: |. xa~t  NB. does it actually work?
1
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to