/ Check-in [df24072d]
Login

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

Overview
Comment:Simplification to the coordinate rounding logic in RTree.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | rtree-32bit-rounding
Files: files | file ages | folders
SHA1:df24072de27555c6b530b02e821ea8b066c554fc
User & Date: drh 2012-05-28 20:16:42
Context
2012-05-29
00:30
Refactor the float-to-double rounding routines so that they compile without warnings. Closed-Leaf check-in: f607ad27 user: drh tags: rtree-32bit-rounding
2012-05-28
20:16
Simplification to the coordinate rounding logic in RTree. check-in: df24072d 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: f4e8ff03 user: drh tags: rtree-32bit-rounding
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/rtree/rtree.c.

  2735   2735     }else{
  2736   2736       nodeRelease(pRtree, pRoot);
  2737   2737     }
  2738   2738   
  2739   2739     return rc;
  2740   2740   }
  2741   2741   
         2742  +#if !defined(SQLITE_RTREE_INT_ONLY)
  2742   2743   /*
  2743   2744   ** Convert an sqlite3_value into an RtreeValue (presumably a float)
  2744   2745   ** while taking care to round toward negative or positive, respectively.
  2745   2746   */
  2746   2747   static RtreeValue rtreeValueDown(sqlite3_value *v){
  2747         -#ifdef SQLITE_RTREE_INT_ONLY
  2748         -  return (RtreeValue)sqlite3_value_double(v);
  2749         -#else
  2750   2748     double d = sqlite3_value_double(v);
  2751   2749     float f = (float)d;
  2752   2750     if( f>d ){
  2753   2751       if( f<0.0 ){
  2754   2752         f += f/8388608.0;
  2755   2753       }else{
  2756   2754         f -= f/8388608.0;
  2757   2755       }
  2758   2756     }
  2759   2757     return f;
  2760         -#endif
  2761   2758   }
  2762   2759   static RtreeValue rtreeValueUp(sqlite3_value *v){
  2763         -#ifdef SQLITE_RTREE_INT_ONLY
  2764         -  return (RtreeValue)sqlite3_value_double(v);
  2765         -#else
  2766   2760     double d = sqlite3_value_double(v);
  2767   2761     float f = (float)d;
  2768   2762     if( f<d ){
  2769   2763       if( f<0.0 ){
  2770   2764         f -= f/8388608.0;
  2771   2765       }else{
  2772   2766         f += f/8388608.0;
  2773   2767       }
  2774   2768     }
  2775   2769     return f;
  2776         -#endif
  2777   2770   }
         2771  +#endif /* !defined(SQLITE_RTREE_INT_ONLY) */
         2772  +
  2778   2773   
  2779   2774   /*
  2780   2775   ** The xUpdate method for rtree module virtual tables.
  2781   2776   */
  2782   2777   static int rtreeUpdate(
  2783   2778     sqlite3_vtab *pVtab, 
  2784   2779     int nData,