Fix test and clang warning

This commit is contained in:
stavrolia 2019-10-18 18:03:15 +03:00
parent 688ec20de1
commit 1397a90324
3 changed files with 18 additions and 10 deletions

View File

@ -22,9 +22,6 @@ namespace ErrorCodes
} }
static const double PI = 3.14159265358979323846; static const double PI = 3.14159265358979323846;
static const double TO_RAD = PI / 180.0;
static const double TO_RAD2 = PI / 360.0;
static const double TO_DEG = 180.0 / PI;
static const float TO_RADF = static_cast<float>(PI / 180.0); static const float TO_RADF = static_cast<float>(PI / 180.0);
static const float TO_RADF2 = static_cast<float>(PI / 360.0); static const float TO_RADF2 = static_cast<float>(PI / 360.0);
static const float TO_DEGF = static_cast<float>(180.0 / PI); static const float TO_DEGF = static_cast<float>(180.0 / PI);

View File

@ -1,3 +1,7 @@
343417
342558
0 0
1
1
1
1
1
1

View File

@ -1,6 +1,13 @@
SELECT floor(greatCircleDistance(33.3, 55.3, 38.7, 55.1)) AS distance;
SELECT floor(greatCircleDistance(33.3 + v, 55.3 + v, 38.7 + v , 55.1 + v)) AS distance from
(
select number + 0.1 as v from system.numbers limit 1
);
SELECT floor(greatCircleDistance(33.3, 55.3, 33.3, 55.3)) AS distance; SELECT floor(greatCircleDistance(33.3, 55.3, 33.3, 55.3)) AS distance;
-- consts are from vincenty formula from geopy
-- k = '158.756175, 53.006373'
-- u = '37.531014, 55.703050'
-- y = '37.588144, 55.733842'
-- m = '37.617780, 55.755830'
-- n = '83.089598, 54.842461'
select abs(greatCircleDistance(37.531014, 55.703050, 37.588144, 55.733842) - 4964.25740448) / 4964.25740448 < 0.004
select abs(greatCircleDistance(37.531014, 55.703050, 37.617780, 55.755830) - 8015.52288508) / 8015.52288508 < 0.004
select abs(greatCircleDistance(37.588144, 55.733842, 37.617780, 55.755830) - 3075.27332275) / 3075.27332275 < 0.004
select abs(greatCircleDistance(83.089598, 54.842461, 37.617780, 55.755830) - 2837839.72863) / 2837839.72863 < 0.004
select abs(greatCircleDistance(37.617780, 55.755830, 158.756175, 53.006373) - 6802821.68814) / 6802821.68814 < 0.004
select abs(greatCircleDistance(83.089598, 54.842461, 158.756175, 53.006373) - 4727216.39539) / 4727216.39539 < 0.004