Content-Length: 261369 | pFad | http://github.com/postgrespro/postgres_cluster/commit/00347575e2754b1aaacd357776560803564d3f35

46 Yet further adjust degree-based trig functions for more portability. · postgrespro/postgres_cluster@0034757 · GitHub
Skip to content

Commit 0034757

Browse files
committed
Yet further adjust degree-based trig functions for more portability.
Buildfarm member cockatiel is still saying that cosd(60) isn't 0.5. What seems likely is that the subexpression (1.0 - cos(x)) isn't being rounded to double width before more arithmetic is done on it, so force that by storing it into a variable.
1 parent 360f67d commit 0034757

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/backend/utils/adt/float.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2000,7 +2000,9 @@ sind_0_to_30(double x)
20002000
static double
20012001
cosd_0_to_60(double x)
20022002
{
2003-
return 1.0 - ((1.0 - cos(x * RADIANS_PER_DEGREE)) / one_minus_cos_60) / 2.0;
2003+
float8 one_minus_cos_x = 1.0 - cos(x * RADIANS_PER_DEGREE);
2004+
2005+
return 1.0 - (one_minus_cos_x / one_minus_cos_60) / 2.0;
20042006
}
20052007

20062008

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/00347575e2754b1aaacd357776560803564d3f35

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy