Skip to content

Commit

Permalink
Lower tolerances of is_close() as we're using 64bit floats now
Browse files Browse the repository at this point in the history
  • Loading branch information
shBLOCK committed Oct 6, 2023
1 parent 83ef3a4 commit 407b612
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions codegen/templates/common_utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ ctypedef long long py_int
ctypedef long double py_float


DEF DEFAULT_RELATIVE_TOLERANCE = 1e-5
DEF DEFAULT_ABSOLUTE_TOLERANCE = 1e-14
DEF DEFAULT_RELATIVE_TOLERANCE = 1e-09
DEF DEFAULT_ABSOLUTE_TOLERANCE = 1e-15


cdef inline bint is_close(py_float a, py_float b, py_float rel_tol = DEFAULT_RELATIVE_TOLERANCE, py_float abs_tol = DEFAULT_ABSOLUTE_TOLERANCE) noexcept:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_transform_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_translation_constructor():

def test_rotating_constructor():
t = Transform3D.rotating(Vec3(1.85, 9.23, 3.42).normalized, 1.98)
assert t.is_close(Transform3D(-0.350185, 0.551229, -0.757309, -0.075323, 0.789313, 0.609353, 0.933647, 0.270429, -0.234886, 0, 0, 0))
assert t.is_close(Transform3D(-0.350185, 0.551229, -0.757309, -0.075323, 0.789313, 0.609353, 0.933647, 0.270429, -0.234886, 0, 0, 0), rel_tol=1e-5)

def test_scaling_constructor():
t = Transform3D.scaling(Vec3(1, 2, 3))
Expand Down

0 comments on commit 407b612

Please sign in to comment.