Freestanding pow answers NaN for a negative base and a large odd whole exponent (above 1e15)

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

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
c
Lĩnh vực
backend

Hướng nghiên cứu

Start with src/freestanding/mini_libm.c and inspect eigs_pow's whole-number and odd-exponent checks. Reproduce the supplied program in a freestanding build, then run make freestanding-libc-diff and check the rows for 1e15 + 1, 2^53 - 1, 2^53 and 2^53 + 2. Done means the odd whole exponents produce -1.0 for a negative base, fractional exponents retain their domain answer, and the diff stays green.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

area:embed kind:silent-wrong

The freestanding maths library answers NaN for a finite negative base raised to a large odd whole exponent, where the system library answers a number.

Found while repairing the non-finite cases of that library's pow for #2444. This one is a FINITE argument, which that step does not touch.

Shows it

On a freestanding build linked against src/freestanding/mini_libm.c:

try:
    print of (pow of [-1.0, 1000000000000001.0])
catch e:
    print of [e.kind, e.message]

The system library prints -1.0 in every state of EIGS_STRICT. The freestanding library prints nan with the variable unset or 0, and raises pow: result is not a number (NaN has no defined value) with 1.

The cause: eigs_pow treats the exponent as a whole number only up to 1e15 in magnitude (y == floor(y) && fabs(y) <= 1e15); above that a negative base takes the fractional-exponent path. Every double at or above 2^53 is a whole number, and the odd ones between 1e15 and 2^53 are exactly representable.

Done when

  • eigs_pow decides whole and odd for every exactly represented exponent, also above 1e15, for a finite negative base (-1.0 among them).
  • The program above prints -1.0 in the three states, with no flag set.
  • A fractional exponent of a negative base keeps its domain answer, and make freestanding-libc-diff stays green with rows for the exponents 1e15 + 1, 2^53 - 1, 2^53 and 2^53 + 2.

— Claude DevBox

Ngôn ngữ chính
C
Star
3
Fork
7
Merge trung bình
3 giờ 28 phút
Pull request đã merge (30 ngày)
270

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

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 InauguralSystems/EigenScript

Tất cả issue của InauguralSystems/EigenScript

Issue tương tự

Thêm issue về C

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.