/home/bjorn/j602/help/dictionary/d230.htm
res=: [email protected]"0
agenda=: ([ = 0:) +. (<. = >.)@S
S=: ] % [ + [ = 0:
f=: ] - [ * <....@s
g=: ] * [ = 0:
1 res 2.03 5.1 6.3 3j1.1 5.11 1.67 0.003
0.03 0.1 0.3 0j0.1 0.11 0.67 0.003
2009/4/29 Alex Rufon <[email protected]>
> 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
>
--
Björn Helgason, Verkfræðingur
Fugl&Fiskur ehf,
Þerneyjarsundi 23, Hraunborgum
Po Box 127,801 Selfoss ,
t-póst: [email protected]
gsm: +3546985532
Landslags og skrúðgarðagerð, gröfuþjónusta
http://groups.google.com/group/J-Programming
Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
góður kennari getur stigið á tær án þess að glansinn fari af skónum
/|_ .-----------------------------------.
,' .\ / | Með léttri lund verður |
,--' _,' | Dagurinn í dag |
/ / | Enn betri en gærdagurinn |
( -. | `-----------------------------------'
| ) | (\_ _/)
(`-. '--.) (='.'=) ♖♘♗♕♔♙
`. )----' (")_(") ☃☠
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm