Use rationals and then convert to float.  Ie:<br><br>&gt; [0.1::Rational,0.2..2]<br>[1 % 10,1 % 5,3 % 10,2 % 5,1 % 2,3 % 5,7 % 10,4 % 5,9 % 10,1 % 1,11 % 10,6 % 5,13 % 10,7 % 5,3 % 2,8 % 5,17 % 10,9 % 5,19 % 10,2 % 1]<br><br>
Then to get something useful from it:<br><br>&gt; map fromRational \$ [0.1::Rational,0.2..2]<br>[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0]<br><br><div class="gmail_quote">On Tue, Feb 5, 2013 at 5:41 PM, yi lu <span dir="ltr">&lt;<a href="mailto:zhiwudazhanjiangshi@gmail.com" target="_blank">zhiwudazhanjiangshi@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I found that in ghci, I input </div><div>[0.1,0.2..2]<br></div><div>and run, I get a result of </div>
<div><br></div><div>[0.1,0.2,0.30000000000000004,0.4000000000000001,0.5000000000000001,0.6000000000000001,0.7000000000000001,0.8,0.9,1.0,1.1,1.2000000000000002,1.3000000000000003,1.4000000000000004,1.5000000000000004,1.6000000000000005,1.7000000000000006,1.8000000000000007,1.9000000000000008,2.000000000000001]</div>

<div><br></div><div>But, as you know, it is not the exact answer.</div><div><br></div><div>So, I wonder if there is something I can do to achieve a better performance and get <span style="background-color:rgb(153,153,153)">[0.1,0.2,0.3,0.4..]</span> as the result.</div>

<div><br></div><div>Thanks.</div></div>
<br>_______________________________________________<br>
Beginners mailing list<br>