/ Changes On Branch rtree-32bit-rounding
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch rtree-32bit-rounding Excluding Merge-Ins

This is equivalent to a diff from bcc72d413e to f607ad27c1

2012-05-29
00:39
In the RTree module, make sure all double-to-float conversions round in a direction to increase the size of element bounding boxes. (check-in: 0abdc2903d user: drh tags: trunk)
00:30
Refactor the float-to-double rounding routines so that they compile without warnings. (Closed-Leaf check-in: f607ad27c1 user: drh tags: rtree-32bit-rounding)
2012-05-28
20:22
Fix the MSVC makefile so that it works with the unicode61 tokenizer. (check-in: 480158143b user: drh tags: trunk)
20:16
Simplification to the coordinate rounding logic in RTree. (check-in: df24072de2 user: drh tags: rtree-32bit-rounding)
19:19
When converting 64-bit floating point coordinates to 32-bit in RTree, take care to round the values such that the size of the bounding box is enlarged. (check-in: f4e8ff03ea user: drh tags: rtree-32bit-rounding)
18:22
Merge the unicode61 tokenizer and the shared-cache-memory database changes into the sessions branch. (check-in: df817e70af user: drh tags: sessions)
17:51
Updates regarding URI query parameters and shared cache in the documentation derived from comments in sqlite.h.in. No changes to code. (check-in: bcc72d413e user: drh tags: trunk)
15:32
Fix Makefile.in so that it works with the new unicode tokenizer of FTS3/4. Update the version number to 3.7.13. (check-in: b8720d0416 user: drh tags: trunk)

Changes to ext/rtree/rtree.c.

2734
2735
2736
2737
2738
2739
2740






























2741
2742
2743
2744
2745
2746
2747
    rc = nodeRelease(pRtree, pRoot);
  }else{
    nodeRelease(pRtree, pRoot);
  }

  return rc;
}































/*
** The xUpdate method for rtree module virtual tables.
*/
static int rtreeUpdate(
  sqlite3_vtab *pVtab, 
  int nData, 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
    rc = nodeRelease(pRtree, pRoot);
  }else{
    nodeRelease(pRtree, pRoot);
  }

  return rc;
}

/*
** Rounding constants for float->double conversion.
*/
#define RNDTOWARDS  (1.0 - 1.0/8388608.0)  /* Round towards zero */
#define RNDAWAY     (1.0 + 1.0/8388608.0)  /* Round away from zero */

#if !defined(SQLITE_RTREE_INT_ONLY)
/*
** Convert an sqlite3_value into an RtreeValue (presumably a float)
** while taking care to round toward negative or positive, respectively.
*/
static RtreeValue rtreeValueDown(sqlite3_value *v){
  double d = sqlite3_value_double(v);
  float f = (float)d;
  if( f>d ){
    f = (float)(d*(d<0 ? RNDAWAY : RNDTOWARDS));
  }
  return f;
}
static RtreeValue rtreeValueUp(sqlite3_value *v){
  double d = sqlite3_value_double(v);
  float f = (float)d;
  if( f<d ){
    f = (float)(d*(d<0 ? RNDTOWARDS : RNDAWAY));
  }
  return f;
}
#endif /* !defined(SQLITE_RTREE_INT_ONLY) */


/*
** The xUpdate method for rtree module virtual tables.
*/
static int rtreeUpdate(
  sqlite3_vtab *pVtab, 
  int nData, 
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
    int ii;

    /* Populate the cell.aCoord[] array. The first coordinate is azData[3]. */
    assert( nData==(pRtree->nDim*2 + 3) );
#ifndef SQLITE_RTREE_INT_ONLY
    if( pRtree->eCoordType==RTREE_COORD_REAL32 ){
      for(ii=0; ii<(pRtree->nDim*2); ii+=2){
        cell.aCoord[ii].f = (RtreeValue)sqlite3_value_double(azData[ii+3]);
        cell.aCoord[ii+1].f = (RtreeValue)sqlite3_value_double(azData[ii+4]);
        if( cell.aCoord[ii].f>cell.aCoord[ii+1].f ){
          rc = SQLITE_CONSTRAINT;
          goto constraint;
        }
      }
    }else
#endif







|
|







2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
    int ii;

    /* Populate the cell.aCoord[] array. The first coordinate is azData[3]. */
    assert( nData==(pRtree->nDim*2 + 3) );
#ifndef SQLITE_RTREE_INT_ONLY
    if( pRtree->eCoordType==RTREE_COORD_REAL32 ){
      for(ii=0; ii<(pRtree->nDim*2); ii+=2){
        cell.aCoord[ii].f = rtreeValueDown(azData[ii+3]);
        cell.aCoord[ii+1].f = rtreeValueUp(azData[ii+4]);
        if( cell.aCoord[ii].f>cell.aCoord[ii+1].f ){
          rc = SQLITE_CONSTRAINT;
          goto constraint;
        }
      }
    }else
#endif