Skip to content

Commit 1e849b1

Browse files
jankorichterMarkus Nullmeier
authored andcommitted
Modify behavior of function set_sphere_output_precision
make tests more precision independent
1 parent 2d97f16 commit 1e849b1

20 files changed

+237
-259
lines changed

doc/appendixes.sgm

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,17 @@
2424
</listitem>
2525
</itemizedlist>
2626
</sect2>
27+
<sect2 id="appendixes.changelog">
28+
<title>
29+
Changes from version 1.1 to 1.2
30+
</title>
31+
<itemizedlist>
32+
<listitem>
33+
<para>
34+
Modify behavior of function <function>set_sphere_output_precision</function>.
35+
</para>
36+
</listitem>
37+
</itemizedlist>
38+
</sect2>
2739

2840
</sect1>

expected/box.out

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
\set ECHO none
2+
set_sphere_output_precision
3+
-----------------------------
4+
SET 8
5+
(1 row)
6+
17
--
28
-- sbox and spoint
39
--

expected/circle.out

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
\set ECHO none
2+
set_sphere_output_precision
3+
-----------------------------
4+
SET 8
5+
(1 row)
6+
17
-- Input/Output ---
28
SELECT set_sphere_output( 'RAD' );
39
set_sphere_output
@@ -6,27 +12,27 @@ SELECT set_sphere_output( 'RAD' );
612
(1 row)
713

814
SELECT '< (1h 2m 30s , +1d 2m 30s), 1.0d >'::scircle;
9-
scircle
10-
-----------------------------------------------------------------
11-
<(0.272707695624114 , 0.0181805130416076) , 0.0174532925199433>
15+
scircle
16+
-------------------------------------------
17+
<(0.2727077 , 0.018180513) , 0.017453293>
1218
(1 row)
1319

1420
SELECT '< (1h 2m 30s , +1d 2m 30s), 1d 30m >'::scircle;
15-
scircle
16-
-----------------------------------------------------------------
17-
<(0.272707695624114 , 0.0181805130416076) , 0.0261799387799149>
21+
scircle
22+
-------------------------------------------
23+
<(0.2727077 , 0.018180513) , 0.026179939>
1824
(1 row)
1925

2026
SELECT '< (1h 2m 30s , +1d 2m 30s), 0.1 >'::scircle;
21-
scircle
22-
--------------------------------------------------
23-
<(0.272707695624114 , 0.0181805130416076) , 0.1>
27+
scircle
28+
-----------------------------------
29+
<(0.2727077 , 0.018180513) , 0.1>
2430
(1 row)
2531

2632
SELECT '< (1h 2m 30s , +1d 2m 30s), 90d >'::scircle;
27-
scircle
28-
--------------------------------------------------------------
29-
<(0.272707695624114 , 0.0181805130416076) , 1.5707963267949>
33+
scircle
34+
-----------------------------------------
35+
<(0.2727077 , 0.018180513) , 1.5707963>
3036
(1 row)
3137

3238
SELECT set_sphere_output( 'DEG' );
@@ -36,27 +42,27 @@ SELECT set_sphere_output( 'DEG' );
3642
(1 row)
3743

3844
SELECT '< (1h 2m 30s , +1d 2m 30s), 1.0d >'::scircle;
39-
scircle
40-
--------------------------------------
41-
<(15.625d , 1.04166666666667d) , 1d>
45+
scircle
46+
-------------------------------
47+
<(15.625d , 1.0416667d) , 1d>
4248
(1 row)
4349

4450
SELECT '< (1h 2m 30s , +1d 2m 30s), 1d 30m >'::scircle;
45-
scircle
46-
----------------------------------------
47-
<(15.625d , 1.04166666666667d) , 1.5d>
51+
scircle
52+
---------------------------------
53+
<(15.625d , 1.0416667d) , 1.5d>
4854
(1 row)
4955

5056
SELECT '< (1h 2m 30s , +1d 2m 30s), 0.1 >'::scircle;
51-
scircle
52-
-----------------------------------------------------
53-
<(15.625d , 1.04166666666667d) , 5.72957795130823d>
57+
scircle
58+
--------------------------------------
59+
<(15.625d , 1.0416667d) , 5.729578d>
5460
(1 row)
5561

5662
SELECT '< (1h 2m 30s , +1d 2m 30s), 90d >'::scircle;
57-
scircle
58-
---------------------------------------
59-
<(15.625d , 1.04166666666667d) , 90d>
63+
scircle
64+
--------------------------------
65+
<(15.625d , 1.0416667d) , 90d>
6066
(1 row)
6167

6268
SELECT set_sphere_output( 'DMS' );

expected/ellipse.out

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
\set ECHO none
2+
set_sphere_output_precision
3+
-----------------------------
4+
SET 8
5+
(1 row)
6+
17
-- ellipse tests
28
--equal operator
39
SELECT sellipse '<{0d,0d},(170d,-12d),0d>' = sellipse '<{0d,0d},(170d,-12d),0d>';

expected/euler.out

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
\set ECHO none
2+
set_sphere_output_precision
3+
-----------------------------
4+
SET 8
5+
(1 row)
6+
17
-- checking Euler transformation operators
28
SELECT strans '-10d,0d,10d,ZZZ' = '-10d,0d,10d,XXX' ;
39
?column?

expected/index.out

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
\set ECHO none
2+
set_sphere_output_precision
3+
-----------------------------
4+
SET 8
5+
(1 row)
6+
17
-- without idx
28
SELECT count(*) FROM spheretmp1 WHERE p @ scircle '<(1,1),0.3>';
39
count

expected/line.out

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
\set ECHO none
2+
set_sphere_output_precision
3+
-----------------------------
4+
SET 8
5+
(1 row)
6+
17
-- checking spherical line operators
28
SELECT sline ( spoint '(0, 90d)', spoint '(0, -89d)' ) =
39
sline ( spoint '(0, 90d)', spoint '(0, -89d)' ) ;

expected/path.out

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
\set ECHO none
2+
set_sphere_output_precision
3+
-----------------------------
4+
SET 8
5+
(1 row)
6+
17
--
28
-- ellipse and path
39
--

expected/points.out

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
\set ECHO none
2+
set_sphere_output_precision
3+
-----------------------------
4+
SET 8
5+
(1 row)
6+
17
-- operators
28
SELECT spoint '(0, 90d)' = spoint '(0, 90d)';
39
?column?
@@ -50,15 +56,15 @@ SELECT set_sphere_output( 'DEG' );
5056
(1 row)
5157

5258
SELECT '( 1h 2m 30s , +1d 2m 30s)'::spoint;
53-
spoint
54-
-------------------------------
55-
(15.625d , 1.04166666666667d)
59+
spoint
60+
------------------------
61+
(15.625d , 1.0416667d)
5662
(1 row)
5763

5864
SELECT '( 0h 2m 30s , +0d 2m 30s)'::spoint;
59-
spoint
60-
--------------------------------
61-
(0.625d , 0.0416666666666667d)
65+
spoint
66+
-------------------------
67+
(0.625d , 0.041666667d)
6268
(1 row)
6369

6470
SELECT '( 1h 3m 30s , -1d 3m 3.6s)'::spoint;
@@ -195,9 +201,9 @@ SELECT '( 0h 2m 30s , 95d 0m 0s)'::spoint;
195201
(1 row)
196202

197203
SELECT '( 24h 2m 30s , 5d 0m 0s)'::spoint;
198-
spoint
199-
---------------------------
200-
(0.624999999999987d , 5d)
204+
spoint
205+
---------------
206+
(0.625d , 5d)
201207
(1 row)
202208

203209
SELECT '( -0h 2m 30s , -5d 0m 0s)'::spoint;
@@ -214,23 +220,23 @@ SELECT '( 0h 2m 30s , -95d 0m 0s)'::spoint;
214220

215221
-- Input --
216222
SELECT '( 0.625d , -0.04166666667d)'::spoint;
217-
spoint
218-
----------------------------
219-
(0.625d , -0.04166666667d)
223+
spoint
224+
--------------------------
225+
(0.625d , -0.041666667d)
220226
(1 row)
221227

222228
SELECT '(0.0109083078249646 , -0.000727220521664407)'::spoint;
223-
spoint
224-
---------------------------------------------
225-
(0.625000000000002d , -0.0416666666666726d)
229+
spoint
230+
--------------------------
231+
(0.625d , -0.041666667d)
226232
(1 row)
227233

228234
-- functions for point --------------
229235
-- spoint(float8, float8)
230236
SELECT spoint(0.0109083078249646 , -0.000727220521664407);
231-
spoint
232-
---------------------------------------------
233-
(0.625000000000002d , -0.0416666666666726d)
237+
spoint
238+
--------------------------
239+
(0.625d , -0.041666667d)
234240
(1 row)
235241

236242
SELECT set_sphere_output( 'RAD' );
@@ -246,9 +252,9 @@ SELECT spoint(7.28318530717958623 , 0.00);
246252
(1 row)
247253

248254
SELECT spoint(0.0 , 2.141592653589793116);
249-
spoint
250-
------------------------
251-
(3.14159265358979 , 1)
255+
spoint
256+
-----------------
257+
(3.1415927 , 1)
252258
(1 row)
253259

254260
-- dist(spoint,spoint)

expected/poly.out

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
\set ECHO none
2+
set_sphere_output_precision
3+
-----------------------------
4+
SET 8
5+
(1 row)
6+
17
-- checking polygon operators
28
\set poly 'spoly \'{(0.1,0),(0.2,0),(0.2,0.1),(0.3,0.1),(0.3,-0.1),(0.4,-0.1),(0.5,0.1),(0.4,0.2),(0.1,0.2)}\''
39
SELECT spoint '(0.15,0.10)' @ :poly; -- point inside polygon
@@ -1698,9 +1704,9 @@ SELECT sellipse '<{5d,2d},(280d,-20d),90d>' && spoly '{(280d,-11d),(280d,-18d)
16981704

16991705
-- create polygon as aggregate
17001706
SELECT spoly(data.p) FROM ( SELECT spoint '(0,1)' as p UNION ALL SELECT spoint '(1,1)' UNION ALL SELECT '(1,0)' ) AS data ;
1701-
spoly
1702-
---------------------------------------------------------------------------------------------
1703-
{(0d , 57.2957795130823d),(57.2957795130823d , 57.2957795130823d),(57.2957795130823d , 0d)}
1707+
spoly
1708+
-------------------------------------------------------------
1709+
{(0d , 57.29578d),(57.29578d , 57.29578d),(57.29578d , 0d)}
17041710
(1 row)
17051711

17061712
-- test stored data

0 commit comments

Comments
 (0)