Skip to content

Commit 3231b88

Browse files
authored
S1Angle::SinCos: Disable sincos for glibc (#414)
S1Angle.Trigonometry fails on Ubuntu 22. Disable for all glibc targets until this can be narrowed down further. ``` /home/runner/work/s2geometry/s2geometry/src/s2/s1angle_test.cc:139: Failure Expected equality of these values: sin_cos.cos Which is: -0.25881904510251996 cos(angle) Which is: -0.25881904510251991 [ FAILED ] S1Angle.Trigonometry (0 ms) ```
1 parent 035272b commit 3231b88

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/s2/s1angle.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,10 @@ inline S1Angle::SinCosPair S1Angle::SinCos() const {
332332
// TODO(b/370513151): Remove once Clang can optimize this.
333333
// NB: __sincos() provided by __APPLE__ is not bit-identical to sin(), cos()
334334
// under `--config=darwin_arm64`.
335-
#if defined(__GLIBC__) || defined(__ANDROID__)
335+
// `sincos` gives different results on Ubuntu 22. Disable for glibc until
336+
// this can be narrowed down further.
337+
// https://github.com/google/s2geometry/issues/413
338+
#if defined(__ANDROID__)
336339
double sin_angle, cos_angle;
337340
sincos(radians(), &sin_angle, &cos_angle);
338341
return {sin_angle, cos_angle};

0 commit comments

Comments
 (0)