It doesn't solve your print precision issue but I'd have used :
   1|5.1
0.1
   decimal=: 1&|
   decimal 5.1
0.1


-----Original Message-----
From: Alex Rufon 

Hello.

I made the following verb to get the decimal value of a floating point number:

decimal=: 3 : 0
y - <. y
)

The problem is this:
      decimal 5.1
0.0999999999999996

But using a decimal value greater than 1 would return the correct result:
      decimal 5.2
0.2
      decimal 5.11
0.11

Any idea what I should do next?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to