Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0c90431

Browse files
committed
Add expected output for netbsd, per report from Patrick Welche.
1 parent50f7b0b commit0c90431

File tree

2 files changed

+263
-0
lines changed

2 files changed

+263
-0
lines changed
Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
--
2+
-- FLOAT8
3+
--
4+
CREATE TABLE FLOAT8_TBL(f1 float8);
5+
INSERT INTO FLOAT8_TBL(f1) VALUES ('0.0');
6+
INSERT INTO FLOAT8_TBL(f1) VALUES ('1004.30');
7+
INSERT INTO FLOAT8_TBL(f1) VALUES ('-34.84');
8+
INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e+200');
9+
INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200');
10+
SELECT '' AS five, FLOAT8_TBL.*;
11+
five | f1
12+
------+----------------------
13+
| 0
14+
| 1004.3
15+
| -34.84
16+
| 1.2345678901234e+200
17+
| 1.2345678901234e-200
18+
(5 rows)
19+
20+
SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE f.f1 <> '1004.3';
21+
four | f1
22+
------+----------------------
23+
| 0
24+
| -34.84
25+
| 1.2345678901234e+200
26+
| 1.2345678901234e-200
27+
(4 rows)
28+
29+
SELECT '' AS one, f.* FROM FLOAT8_TBL f WHERE f.f1 = '1004.3';
30+
one | f1
31+
-----+--------
32+
| 1004.3
33+
(1 row)
34+
35+
SELECT '' AS three, f.* FROM FLOAT8_TBL f WHERE '1004.3' > f.f1;
36+
three | f1
37+
-------+----------------------
38+
| 0
39+
| -34.84
40+
| 1.2345678901234e-200
41+
(3 rows)
42+
43+
SELECT '' AS three, f.* FROM FLOAT8_TBL f WHERE f.f1 < '1004.3';
44+
three | f1
45+
-------+----------------------
46+
| 0
47+
| -34.84
48+
| 1.2345678901234e-200
49+
(3 rows)
50+
51+
SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE '1004.3' >= f.f1;
52+
four | f1
53+
------+----------------------
54+
| 0
55+
| 1004.3
56+
| -34.84
57+
| 1.2345678901234e-200
58+
(4 rows)
59+
60+
SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE f.f1 <= '1004.3';
61+
four | f1
62+
------+----------------------
63+
| 0
64+
| 1004.3
65+
| -34.84
66+
| 1.2345678901234e-200
67+
(4 rows)
68+
69+
SELECT '' AS three, f.f1, f.f1 * '-10' AS x
70+
FROM FLOAT8_TBL f
71+
WHERE f.f1 > '0.0';
72+
three | f1 | x
73+
-------+----------------------+-----------------------
74+
| 1004.3 | -10043
75+
| 1.2345678901234e+200 | -1.2345678901234e+201
76+
| 1.2345678901234e-200 | -1.2345678901234e-199
77+
(3 rows)
78+
79+
SELECT '' AS three, f.f1, f.f1 + '-10' AS x
80+
FROM FLOAT8_TBL f
81+
WHERE f.f1 > '0.0';
82+
three | f1 | x
83+
-------+----------------------+----------------------
84+
| 1004.3 | 994.3
85+
| 1.2345678901234e+200 | 1.2345678901234e+200
86+
| 1.2345678901234e-200 | -10
87+
(3 rows)
88+
89+
SELECT '' AS three, f.f1, f.f1 / '-10' AS x
90+
FROM FLOAT8_TBL f
91+
WHERE f.f1 > '0.0';
92+
three | f1 | x
93+
-------+----------------------+-----------------------
94+
| 1004.3 | -100.43
95+
| 1.2345678901234e+200 | -1.2345678901234e+199
96+
| 1.2345678901234e-200 | -1.2345678901234e-201
97+
(3 rows)
98+
99+
SELECT '' AS three, f.f1, f.f1 - '-10' AS x
100+
FROM FLOAT8_TBL f
101+
WHERE f.f1 > '0.0';
102+
three | f1 | x
103+
-------+----------------------+----------------------
104+
| 1004.3 | 1014.3
105+
| 1.2345678901234e+200 | 1.2345678901234e+200
106+
| 1.2345678901234e-200 | 10
107+
(3 rows)
108+
109+
SELECT '' AS one, f.f1 ^ '2.0' AS square_f1
110+
FROM FLOAT8_TBL f where f.f1 = '1004.3';
111+
one | square_f1
112+
-----+------------
113+
| 1008618.49
114+
(1 row)
115+
116+
-- absolute value
117+
SELECT '' AS five, f.f1, @f.f1 AS abs_f1
118+
FROM FLOAT8_TBL f;
119+
five | f1 | abs_f1
120+
------+----------------------+----------------------
121+
| 0 | 0
122+
| 1004.3 | 1004.3
123+
| -34.84 | 34.84
124+
| 1.2345678901234e+200 | 1.2345678901234e+200
125+
| 1.2345678901234e-200 | 1.2345678901234e-200
126+
(5 rows)
127+
128+
-- truncate
129+
SELECT '' AS five, f.f1, %f.f1 AS trunc_f1
130+
FROM FLOAT8_TBL f;
131+
five | f1 | trunc_f1
132+
------+----------------------+----------------------
133+
| 0 | 0
134+
| 1004.3 | 1004
135+
| -34.84 | -34
136+
| 1.2345678901234e+200 | 1.2345678901234e+200
137+
| 1.2345678901234e-200 | 0
138+
(5 rows)
139+
140+
-- round
141+
SELECT '' AS five, f.f1, f.f1 % AS round_f1
142+
FROM FLOAT8_TBL f;
143+
five | f1 | round_f1
144+
------+----------------------+----------------------
145+
| 0 | 0
146+
| 1004.3 | 1004
147+
| -34.84 | -35
148+
| 1.2345678901234e+200 | 1.2345678901234e+200
149+
| 1.2345678901234e-200 | 0
150+
(5 rows)
151+
152+
SELECT sqrt(float8 '64') AS eight;
153+
eight
154+
-------
155+
8
156+
(1 row)
157+
158+
-- square root
159+
SELECT |/ float8 '64' AS eight;
160+
eight
161+
-------
162+
8
163+
(1 row)
164+
165+
SELECT '' AS three, f.f1, |/f.f1 AS sqrt_f1
166+
FROM FLOAT8_TBL f
167+
WHERE f.f1 > '0.0';
168+
three | f1 | sqrt_f1
169+
-------+----------------------+-----------------------
170+
| 1004.3 | 31.6906926399535
171+
| 1.2345678901234e+200 | 1.11111110611109e+100
172+
| 1.2345678901234e-200 | 1.11111110611109e-100
173+
(3 rows)
174+
175+
-- take exp of ln(f.f1)
176+
SELECT '' AS three, f.f1, exp(ln(f.f1)) AS exp_ln_f1
177+
FROM FLOAT8_TBL f
178+
WHERE f.f1 > '0.0';
179+
three | f1 | exp_ln_f1
180+
-------+----------------------+-----------------------
181+
| 1004.3 | 1004.3
182+
| 1.2345678901234e+200 | 1.23456789012338e+200
183+
| 1.2345678901234e-200 | 1.23456789012339e-200
184+
(3 rows)
185+
186+
-- cube root
187+
SELECT ||/ float8 '27' AS three;
188+
three
189+
-------
190+
3
191+
(1 row)
192+
193+
SELECT '' AS five, f.f1, ||/f.f1 AS cbrt_f1 FROM FLOAT8_TBL f;
194+
five | f1 | cbrt_f1
195+
------+----------------------+----------------------
196+
| 0 | 0
197+
| 1004.3 | 10.014312837827
198+
| -34.84 | -3.26607421344208
199+
| 1.2345678901234e+200 | 4.97933859234765e+66
200+
| 1.2345678901234e-200 | 2.3112042409018e-67
201+
(5 rows)
202+
203+
SELECT '' AS five, FLOAT8_TBL.*;
204+
five | f1
205+
------+----------------------
206+
| 0
207+
| 1004.3
208+
| -34.84
209+
| 1.2345678901234e+200
210+
| 1.2345678901234e-200
211+
(5 rows)
212+
213+
UPDATE FLOAT8_TBL
214+
SET f1 = FLOAT8_TBL.f1 * '-1'
215+
WHERE FLOAT8_TBL.f1 > '0.0';
216+
SELECT '' AS bad, f.f1 * '1e200' from FLOAT8_TBL f;
217+
ERROR: Bad float8 input format -- overflow
218+
SELECT '' AS bad, f.f1 ^ '1e200' from FLOAT8_TBL f;
219+
ERROR: pow() result is out of range
220+
SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 = '0.0' ;
221+
ERROR: can't take log of zero
222+
SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 < '0.0' ;
223+
ERROR: can't take log of a negative number
224+
SELECT '' AS bad, exp(f.f1) from FLOAT8_TBL f;
225+
ERROR: exp() result is out of range
226+
SELECT '' AS bad, f.f1 / '0.0' from FLOAT8_TBL f;
227+
ERROR: float8div: divide by zero error
228+
SELECT '' AS five, FLOAT8_TBL.*;
229+
five | f1
230+
------+-----------------------
231+
| 0
232+
| -34.84
233+
| -1004.3
234+
| -1.2345678901234e+200
235+
| -1.2345678901234e-200
236+
(5 rows)
237+
238+
-- test for over- and underflow
239+
INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
240+
ERROR: Input '10e400' is out of range for float8
241+
INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
242+
ERROR: Input '-10e400' is out of range for float8
243+
INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400');
244+
INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400');
245+
-- maintain external table consistency across platforms
246+
-- delete all values and reinsert well-behaved ones
247+
DELETE FROM FLOAT8_TBL;
248+
INSERT INTO FLOAT8_TBL(f1) VALUES ('0.0');
249+
INSERT INTO FLOAT8_TBL(f1) VALUES ('-34.84');
250+
INSERT INTO FLOAT8_TBL(f1) VALUES ('-1004.30');
251+
INSERT INTO FLOAT8_TBL(f1) VALUES ('-1.2345678901234e+200');
252+
INSERT INTO FLOAT8_TBL(f1) VALUES ('-1.2345678901234e-200');
253+
SELECT '' AS five, FLOAT8_TBL.*;
254+
five | f1
255+
------+-----------------------
256+
| 0
257+
| -34.84
258+
| -1004.3
259+
| -1.2345678901234e+200
260+
| -1.2345678901234e-200
261+
(5 rows)
262+

‎src/test/regress/resultmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ int4/.*-aix4=int4-too-large
2020
float8/alpha.*-dec-osf=float8-fp-exception
2121
float4/.*-qnx4=float4-exp-three-digits
2222
float8/.*-qnx4=float8-exp-three-digits
23+
float8/.*-netbsd=float8-small-is-zero
2324
geometry/hppa=geometry-positive-zeros
2425
geometry/.*-netbsd=geometry-positive-zeros
2526
geometry/.*-freebsd=geometry-positive-zeros

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp