Members of the Forum -

Do these cases seem odd?

   triNum=: ([:-:[:*/0 1+])"0  NB. triangular number by Gauss
   aa=. triNum x: 1e10        NB. ten-billionth triangular number
   3!:0]aa                           NB. Type is "rational"
128
   aa
50000000005000000000
   aa=. triNum  x: 1e9   NB. but billionth triangular number
   3!:0]aa                     NB. is "extended integer".
64
   ss=. $aa,aa              NB. Even more oddly,
   3!:0]ss                     NB. this shape is "extended integer".
64
   ss=. <.0.5+*:%:ss    NB. Force type to plain integer.
   3!:0]ss
4

Why does an argument of "x: 1e10" give a rational result but a smaller
argument is extended integer?
More puzzling, why does the shape of an array of extended integers have the
type "extended integer"?

-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to