Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Loosely assert for functions that produce ints but internally might use floats

Đang mở
#154 8 bình luận 0 reaction 1 người được giao Xem trên GitHub

@honno đang làm issue này rồi.

Từ ngày 1/11/2022.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

It looks like the test_trunc reference implementation is math.trunc for at least a subset of the checks. I noticed that for some large values there is a mismatch with both the pykokkos (ultimately C++) version of trunc and math.trunc, which causes the conformance test to fail. I see the same thing in NumPy as well--do you have a suggestion on how I should proceed here? Is this effectively related to arbitrary precision Python integers, etc.?

I'll just use NumPy rather than pykokkos below, to keep things familiar:

>>> import math
>>> import numpy as np
>>> math.trunc(9007199254740993)
9007199254740993
>>> np.trunc(9007199254740993)
9007199254740992.0

And then in the conformance testing: pytest array_api_tests/test_operators_and_elementwise_functions.py::test_trunc

AssertionError: out[0]=9007199254740992, but should be trunc(x[0])=9007199254740993 [trunc()]

Would you say that my reference implementation in pykokkos and the exposed NumPy trunc are both wrong here, and the test suite is correct or?

Ngôn ngữ chính
Python
Star
74
Fork
54
Merge trung bình
4 giờ 35 phút
Pull request đã merge (30 ngày)
4

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của data-apis/array-api-tests

Tất cả issue của data-apis/array-api-tests

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.