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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy