null+****@clear*****
null+****@clear*****
2011年 11月 21日 (月) 14:06:27 JST
Daijiro MORI 2011-11-21 05:06:27 +0000 (Mon, 21 Nov 2011)
New Revision: ec118f957741f420c996489e0e463ad6c443aab7
Log:
simplified GRN_GEO_DEGREE2MSEC
Modified files:
include/groonga.h
test/unit/core/test-cast-basic.c
Modified: include/groonga.h (+1 -4)
===================================================================
--- include/groonga.h 2011-11-20 22:13:26 +0000 (000d74b)
+++ include/groonga.h 2011-11-21 05:06:27 +0000 (79926d0)
@@ -2219,11 +2219,8 @@ GRN_API grn_rc grn_text_otoj(grn_ctx *ctx, grn_obj *bulk, grn_obj *obj,
grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(grn_obj *));\
} while (0)
-#define GRN_GEO_DEGREE_ACCURACY 10000000
#define GRN_GEO_DEGREE2MSEC(degree)\
- ((int)(((int)(degree) * 60 * 60 * 1000) +\
- (((long)((degree) * GRN_GEO_DEGREE_ACCURACY) % GRN_GEO_DEGREE_ACCURACY) * 60 / GRN_GEO_DEGREE_ACCURACY * 60 * 1000) +\
- (((long)((degree) * GRN_GEO_DEGREE_ACCURACY) % GRN_GEO_DEGREE_ACCURACY) * 60 % GRN_GEO_DEGREE_ACCURACY * 60 / 10000)))
+ ((int)((degree) * 3600 * 1000 + ((degree) > 0 ? 0.5 : -0.5)))
#define GRN_GEO_MSEC2DEGREE(msec)\
((((int)(msec)) / 3600.0) * 0.001)
Modified: test/unit/core/test-cast-basic.c (+2 -2)
===================================================================
--- test/unit/core/test-cast-basic.c 2011-11-20 22:13:26 +0000 (61f3415)
+++ test/unit/core/test-cast-basic.c 2011-11-21 05:06:27 +0000 (4186c95)
@@ -956,7 +956,7 @@ test_tokyo_geo_point_to_wgs84_geo_point(void)
gint takane_latitude, takane_longitude;
gint takane_latitude_in_tokyo_geodetic_system = 130183139;
gint takane_longitude_in_tokyo_geodetic_system = 503813760;
- gint takane_latitude_in_wgs84 = 130194580;
+ gint takane_latitude_in_wgs84 = 130194581;
gint takane_longitude_in_wgs84 = 503802072;
grn_obj_reinit(&context, &src, GRN_DB_TOKYO_GEO_POINT, 0);
@@ -1000,7 +1000,7 @@ test_wgs84_geo_point_to_tokyo_geo_point(void)
gint takane_latitude, takane_longitude;
gint takane_latitude_in_wgs84 = 130194581;
gint takane_longitude_in_wgs84 = 503802073;
- gint takane_latitude_in_tokyo_geodetic_system = 130183139;
+ gint takane_latitude_in_tokyo_geodetic_system = 130183140;
gint takane_longitude_in_tokyo_geodetic_system = 503813760;
grn_obj_reinit(&context, &src, GRN_DB_WGS84_GEO_POINT, 0);