[Groonga-commit] groonga/groonga [master] reduce geo point convertion from degree to msec error.

Back to archive index

null+****@clear***** null+****@clear*****
2011年 3月 9日 (水) 15:55:13 JST


Kouhei Sutou	2011-03-09 06:55:13 +0000 (Wed, 09 Mar 2011)

  New Revision: 27934c8b89dc9b36d7271f8ac6cc3d2dd69f32fa

  Log:
    reduce geo point convertion from degree to msec error.

  Modified files:
    lib/db.c

  Modified: lib/db.c (+3 -3)
===================================================================
--- lib/db.c    2011-03-09 05:19:55 +0000 (0cda615)
+++ lib/db.c    2011-03-09 06:55:13 +0000 (4af3a1f)
@@ -3873,9 +3873,9 @@ grn_obj_is_persistent(grn_ctx *ctx, grn_obj *obj)
 #define DEGREE_ACCURACY 10000000
 
 #define DEGREE2MSEC(degree)\
-  (((int)degree * 60 * 60 * 1000) +\
-   (((int)(degree * DEGREE_ACCURACY) % DEGREE_ACCURACY) * 60 / DEGREE_ACCURACY * 60 * 1000) +\
-   (((int)(degree * DEGREE_ACCURACY) % DEGREE_ACCURACY) * 60 % DEGREE_ACCURACY * 60 / 10000))
+  ((int)((int)(degree * 60 * 60 * 1000) +\
+         (((long)(degree * DEGREE_ACCURACY) % DEGREE_ACCURACY) * 60 / DEGREE_ACCURACY * 60 * 1000) +\
+         (((long)(degree * DEGREE_ACCURACY) % DEGREE_ACCURACY) * 60 % DEGREE_ACCURACY * 60 / 10000)))
 
 grn_rc
 grn_obj_cast(grn_ctx *ctx, grn_obj *src, grn_obj *dest, int addp)




Groonga-commit メーリングリストの案内
Back to archive index