while rebuilding postgres with msvc 2005 I noticed some minor compiler warnings:

.\src\backend\utils\adt\tsrank.c(24): warning C4305: 'initializing' : truncation from 'double' to 'float' .\src\backend\utils\adt\tsrank.c(24): warning C4305: 'initializing' : truncation from 'double' to 'float' .\src\backend\utils\adt\tsrank.c(24): warning C4305: 'initializing' : truncation from 'double' to 'float' .\src\backend\utils\adt\tsrank.c(46): warning C4305: 'return' : truncation from 'double' to 'float4' .\src\backend\utils\adt\tsrank.c(339): warning C4305: '=' : truncation from 'double' to 'float'


see attached diff

-Hannes

*** ../pgsql-cvshead/src/backend/utils/adt/tsrank.c     Thu Sep 20 10:30:19 2007
--- src/backend/utils/adt/tsrank.c      Thu Sep 20 12:20:10 2007
***************
*** 21,27 ****
  #include "miscadmin.h"
  
  
! static float weights[] = {0.1, 0.2, 0.4, 1.0};
  
  #define wpos(wep)     ( w[ WEP_GETWEIGHT(wep) ] )
  
--- 21,27 ----
  #include "miscadmin.h"
  
  
! static float weights[] = {0.1f, 0.2f, 0.4f, 1.0f};
  
  #define wpos(wep)     ( w[ WEP_GETWEIGHT(wep) ] )
  
***************
*** 43,49 ****
  word_distance(int4 w)
  {
        if (w > 100)
!               return 1e-30;
  
        return 1.0 / (1.005 + 0.05 * exp(((float4) w) / 1.5 - 2));
  }
--- 43,49 ----
  word_distance(int4 w)
  {
        if (w > 100)
!               return 1e-30f;
  
        return 1.0 / (1.005 + 0.05 * exp(((float4) w) / 1.5 - 2));
  }
***************
*** 336,342 ****
                calc_rank_and(w, t, q) : calc_rank_or(w, t, q);
  
        if (res < 0)
!               res = 1e-20;
  
        if ((method & RANK_NORM_LOGLENGTH) && t->size > 0)
                res /= log((double) (cnt_length(t) + 1)) / log(2.0);
--- 336,342 ----
                calc_rank_and(w, t, q) : calc_rank_or(w, t, q);
  
        if (res < 0)
!               res = 1e-20f;
  
        if ((method & RANK_NORM_LOGLENGTH) && t->size > 0)
                res /= log((double) (cnt_length(t) + 1)) / log(2.0);
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to