<div>
                    Matthew,
                </div><div>I see. I din't think about tolerance. Although</div><div><br></div><div>dt[with(dt, order(y)), ] </div><div><br></div><div>seems to do the task right (similar to data.frame). I'm glad that I don't have to convert to data.frame to perform the order. I am not keying by this column. Unless one needs this column for keying, I don't think a tolerance option is essential. Although, having it definitely would be only nicer.</div><div><br></div><div><div>Arun</div><div><br></div></div>
                 
                <p style="color: #A0A0A8;">On Tuesday, April 30, 2013 at 4:09 PM, Matthew Dowle wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div>

<p> </p>
<p>Hi,</p>
<p>data.table sorts double within machine tolerance :</p>
<pre>> sqrt(.Machine$double.eps)<br>[1] 1.490116e-08<br>> </pre>
<pre> </pre>
<pre>i.e. numbers closer than this are considered equal.</pre>
<pre> </pre>
<pre>Otherwise we wouldn't be able to do things like  DT[.(3.14)].</pre>
<pre> </pre>
<pre>I had a quick look,  see arguments of   data.table:::ordernumtol   which takes "tol"  but there is no option provided (yet) to change this.  Do we need one?</pre>
<pre> </pre>
<pre>In the examples section of one of the help pages it has an example which generates a series of numers very close together using pi.   Note that your numbers are both close together, and, very close to 0.</pre>
<pre> </pre>
<pre>Matthew</pre>
<p> </p>
<p>On 30.04.2013 14:52, Arunkumar Srinivasan wrote:</p><blockquote type="cite"><div><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<div>Hi there,</div>
<div>I just saw something strange when I was sorting a column of p-values. I checked the data.table bug tracker for words "sort" and "floating point" and there were no hits for this case. There's a bug for "integer 64" sort on a column though.</div>
<div>So, here's a reproducible example. I'd be glad to file a bug, if it is and be corrected if it's something I am doing wrong.</div>
<div>
<div>set.seed(45)</div>
<div>dt <- data.table(x=sample(50), y= sample(c(seq(0, 1, length.out=1000), 7000000:7000100), 50)/1e7)</div>
<div>head(dt)</div>
<div>    x            y</div>
<div>1: 32 5.395395e-08</div>
<div>2: 16 6.956957e-08</div>
<div>3: 12 2.142142e-08</div>
<div>4: 18 5.855856e-08</div>
<div>5: 17 6.216216e-08</div>
<div>6: 14 5.025025e-08</div>
<div>setkey(dt, "y") # sort by column y</div>
<div>head(dt, 10)</div>
<div>     x            y</div>
<div> 1: 47 1.401401e-09</div>
<div> 2: 12 2.142142e-08</div>
<div> 3: 24 1.391391e-08</div>
<div> 4: 43 9.809810e-09 <~~~ obviously false</div>
<div> 5:  1 2.932933e-08</div>
<div> 6: 48 2.562563e-08</div>
<div> 7: 49 1.891892e-08</div>
<div> 8: 40 2.182182e-08</div>
<div> 9:  9 7.307307e-09 <~~~ obviously false</div>
<div>10: 45 2.482482e-08</div>
</div>
<div>
<div>Best,</div>
<div>Arun</div>
</div>
</div></blockquote><p> </p>
<div> </div>

</div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>