mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Adjust degree-based trig functions for more portability.
The buildfarm isn't very happy with the results of commit e1bd684a34
.
To try to get the expected exact results everywhere:
* Replace M_PI / 180 subexpressions with a precomputed constant, so that
the compiler can't decide to rearrange that division with an adjacent
operation. Hopefully this will fix failures to get exactly 0.5 from
sind(30) and cosd(60).
* Add scaling to ensure that tand(45) and cotd(45) give exactly 1; there
was nothing particularly guaranteeing that before.
* Replace minus zero by zero when tand() or cotd() would output that;
many machines did so for tand(180) and cotd(270), but not all. We could
alternatively deem both results valid, but that doesn't seem likely to
be what users will want.
This commit is contained in:
@ -467,13 +467,13 @@ FROM generate_series(0, 360, 15) AS t(x);
|
||||
135 | | | -1 | -1
|
||||
150 | 0.5 | | |
|
||||
165 | | | |
|
||||
180 | 0 | -1 | -0 | -Infinity
|
||||
180 | 0 | -1 | 0 | -Infinity
|
||||
195 | | | |
|
||||
210 | -0.5 | | |
|
||||
225 | | | 1 | 1
|
||||
240 | | -0.5 | |
|
||||
255 | | | |
|
||||
270 | -1 | 0 | -Infinity | -0
|
||||
270 | -1 | 0 | -Infinity | 0
|
||||
285 | | | |
|
||||
300 | | 0.5 | |
|
||||
315 | | | -1 | -1
|
||||
|
@ -465,13 +465,13 @@ FROM generate_series(0, 360, 15) AS t(x);
|
||||
135 | | | -1 | -1
|
||||
150 | 0.5 | | |
|
||||
165 | | | |
|
||||
180 | 0 | -1 | -0 | -Infinity
|
||||
180 | 0 | -1 | 0 | -Infinity
|
||||
195 | | | |
|
||||
210 | -0.5 | | |
|
||||
225 | | | 1 | 1
|
||||
240 | | -0.5 | |
|
||||
255 | | | |
|
||||
270 | -1 | 0 | -Infinity | -0
|
||||
270 | -1 | 0 | -Infinity | 0
|
||||
285 | | | |
|
||||
300 | | 0.5 | |
|
||||
315 | | | -1 | -1
|
||||
|
@ -465,13 +465,13 @@ FROM generate_series(0, 360, 15) AS t(x);
|
||||
135 | | | -1 | -1
|
||||
150 | 0.5 | | |
|
||||
165 | | | |
|
||||
180 | 0 | -1 | -0 | -Infinity
|
||||
180 | 0 | -1 | 0 | -Infinity
|
||||
195 | | | |
|
||||
210 | -0.5 | | |
|
||||
225 | | | 1 | 1
|
||||
240 | | -0.5 | |
|
||||
255 | | | |
|
||||
270 | -1 | 0 | -Infinity | -0
|
||||
270 | -1 | 0 | -Infinity | 0
|
||||
285 | | | |
|
||||
300 | | 0.5 | |
|
||||
315 | | | -1 | -1
|
||||
|
@ -467,13 +467,13 @@ FROM generate_series(0, 360, 15) AS t(x);
|
||||
135 | | | -1 | -1
|
||||
150 | 0.5 | | |
|
||||
165 | | | |
|
||||
180 | 0 | -1 | -0 | -Infinity
|
||||
180 | 0 | -1 | 0 | -Infinity
|
||||
195 | | | |
|
||||
210 | -0.5 | | |
|
||||
225 | | | 1 | 1
|
||||
240 | | -0.5 | |
|
||||
255 | | | |
|
||||
270 | -1 | 0 | -Infinity | -0
|
||||
270 | -1 | 0 | -Infinity | 0
|
||||
285 | | | |
|
||||
300 | | 0.5 | |
|
||||
315 | | | -1 | -1
|
||||
|
Reference in New Issue
Block a user