Skip to content

Commit 5b3582a

Browse files
committed
eval: adjust a couple trig eval tests for s390x
This commit is similar in spirit to ba3639d. It turns out that s390x produces slightly different results when evaluating some trig functions like `atan` (possibly because it has architecture support, meaning it's implemented in assembly). This commit adjusts a few tests to use rounding to hide those differences. Release note: None
1 parent 7898c83 commit 5b3582a

File tree

1 file changed

+11
-6
lines changed
  • pkg/sql/sem/eval/testdata/eval

1 file changed

+11
-6
lines changed

pkg/sql/sem/eval/testdata/eval/trig

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# Trig functions
2+
#
23
# In some cases x64 and arm64 may yeild slightly different results due to float
34
# operation ordering/fusing differences, as allowed by spec, so some results are
45
# checks using round(expr, 10) to ignore any minute float differences.
6+
#
7+
# Similarly, s390x can produce slightly different results (e.g. since it has
8+
# architectural support for some trig functions like atan), so we check rounded
9+
# results too.
510

611
eval
712
cos(0)
@@ -34,14 +39,14 @@ asin(1.0)
3439
1.5707963267948966
3540

3641
eval
37-
atan(1.0)
42+
round(atan(1.0), 15)
3843
----
39-
0.7853981633974483
44+
0.785398163397448
4045

4146
eval
42-
atan2(1.0, 1.0)
47+
round(atan2(1.0, 1.0), 15)
4348
----
44-
0.7853981633974483
49+
0.785398163397448
4550

4651
eval
4752
cosd(0)
@@ -74,12 +79,12 @@ asind(1.0)
7479
90.0
7580

7681
eval
77-
atand(1.0)
82+
round(atand(1.0), 10)
7883
----
7984
45.0
8085

8186
eval
82-
atan2d(1.0, 1.0)
87+
round(atan2d(1.0, 1.0), 10)
8388
----
8489
45.0
8590

0 commit comments

Comments
 (0)