Thanks very much to those who responded.
It seems that most of the difficulty i had was traceable to x: not
forcing the equivalent of the sqrt function before floor was applied.
I was mainly interested in getting the correct floor but the other
information and directions are most useful.
I clearly have a lot of catching up to do.
As regards the second area "the product of primes" i found that it was
necessary to use x: at the very beginning, so that problem is overcome.
In case my misunderstanding is helpful to others...
NB. it appears that "ordinary" integers need to be processed with x: in
some cases
NB. or else a later calculation may not be in ep mode
NB. "ep" == extended precision
NB. This case doesn't tag the output as exact integers for later
calculation, ie extended precision isn't forced in respect of earlier
variables simply by using x: in later calculations
pns=: ~.4 p:i.53
pns
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53
NB. i had expected if x: was used in the following statement that ep
would be forced for all inputs
NB. maybe a "nice to have"?
pp=:x:*/pns
pp
32589158477190045696 NB. incorrect because input has 2*5 the
result has to end in 0
x:pns|pp
0 0 1 0 9 4 14 16 0 9 5 4 23 20 26 12
NB. oops the ordinary integers in */pns though just plain integers
don't produce a correct result for pp just because x: is used in the
statement
NB. Now tag the first calculation with x:
pns=:x: ~.4 p:i.53
pns
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53
NB. looks the same, but treated differently
pp=:x:*/pns
pp
32589158477190044730 NB. correct
NB. and gives different and correct result below
x:pns|pp
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 NB. what i needed, but also
pns|pp NB. didn't need the x:
there; ... it is just pns that needed to be set up "right"
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Thanks again for the earlier advice.
--
Regards,
Gerry Jensen
02 9713 6004
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm