Since x: converts a float to a rat you'd expect that x:^:_1 converts a
rat to a float.  And it does:

   x:^:_1 ]1r3
0.333333

For coding convenience _1&x: does the same:

   _1 x: 1r3
0.333333



On Mon, Oct 31, 2011 at 7:28 AM, Ian Clark <[email protected]> wrote:
> How best should I coerce (if that's an appropriate word to use in a J
> context) a noun which possibly contains a rational, eg 1r3, to the
> nearest floating-point number?
> ...So that it outputs as 0.333333 instead of 1r3 ?
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to