mirror of
https://github.com/google/go-jsonnet.git
synced 2025-09-28 17:01:02 +02:00
Introduce tolerance in tests of numeric functions.
There are slight differences across CPU architectures which we cannot avoid. These should have no practical consequences for the users.
This commit is contained in:
parent
03f5ad2dc0
commit
5976644a3b
2
testdata/builtin_atan.golden
vendored
2
testdata/builtin_atan.golden
vendored
@ -1 +1 @@
|
|||||||
0.78539816339744828
|
"0.785398163397448"
|
||||||
|
3
testdata/builtin_atan.jsonnet
vendored
3
testdata/builtin_atan.jsonnet
vendored
@ -1 +1,2 @@
|
|||||||
std.atan(1)
|
local tolerance = (import 'tolerance.libsonnet').tolerance;
|
||||||
|
tolerance(std.atan(1))
|
||||||
|
2
testdata/builtin_tan.golden
vendored
2
testdata/builtin_tan.golden
vendored
@ -1 +1 @@
|
|||||||
1.5574077246549021
|
"1.557407724654902"
|
||||||
|
3
testdata/builtin_tan.jsonnet
vendored
3
testdata/builtin_tan.jsonnet
vendored
@ -1 +1,2 @@
|
|||||||
std.tan(1)
|
local tolerance = (import 'tolerance.libsonnet').tolerance;
|
||||||
|
tolerance(std.tan(1))
|
||||||
|
2
testdata/pow5.golden
vendored
2
testdata/pow5.golden
vendored
@ -1 +1 @@
|
|||||||
1.1486983549970351
|
"1.148698354997035"
|
||||||
|
3
testdata/pow5.jsonnet
vendored
3
testdata/pow5.jsonnet
vendored
@ -1 +1,2 @@
|
|||||||
std.pow(2, 0.2)
|
local tolerance = (import 'tolerance.libsonnet').tolerance;
|
||||||
|
tolerance(std.pow(2, 0.2))
|
||||||
|
7
testdata/tolerance.libsonnet
vendored
Normal file
7
testdata/tolerance.libsonnet
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
// Formats a floating point number to get 15 digits
|
||||||
|
// after the decimal point. It is used for some tests
|
||||||
|
// of numeric functions, where a range of values is
|
||||||
|
// acceptable, due to differences in cpu architecture.
|
||||||
|
tolerance(x):: "%.15f" % x
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user