This seems to work quite well:

    ((<.`(<.@%&10)@. (0=10&|) )^:_)"0] 12345024500000 1000001 0
123450245 1000001 0

I had another method involving q: and dividing by 10 ^ the
lesser of the powers of 2 and 5 in the factors,  but it hangs J in
some circumstances!

You could also remove rightmost "0" characters in the
formatted representation(s) of the number(s),
   eg
    (#~-.@:((*/\.)@:('0'&=))) '12345024500000'
123450245
But it's a bit tricky to ensure you don't have
the representation in  scientific notation,
eg
   1.2345e13

Mike



On 17/09/2011 10:05 PM, David Vaughan wrote:
> Hi, how could I drop trailing zeros from a number? e.g. 123450245000 becomes
> 123450245
> ----------------------------------------------------------------------
> For information about J forums seehttp://www.jsoftware.com/forums.htm
>


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to