0.0999999999999996 is probably a correct floating point representation of 0..1.
Coding a hook is shorter, however: decimal =: -<. --- Den ons 29/4/09 skrev Alex Rufon <[email protected]>: > Fra: Alex Rufon <[email protected]> > Emne: [Jprogramming] Getting the decimal values > Til: "Programming forum" <[email protected]> > Dato: onsdag 29. april 2009 13.28 > 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? > > Thanks. > > r/Alex > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ________________________________________________________ Audi, Fiat, Peugeot, Skoda, Porsche, Toyota, Ford - Kelkoo har brugte biler til en hver smag! Klik her for at sammenligne priser.(http://dk.yahoo.com/r/pat/mmb) ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
