currency at the half cent

Đang mở
#1,324 1 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 4 ngày

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

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
22/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
perl
Lĩnh vực
backend

Hướng nghiên cứu

Start with the Currency() constructor and its cmp method, which the issue says should round the correct answer to two decimals when the context forbids more than two decimal places. Reproduce the half-cent case with Currency(12.345) under the default tolerance, using the contextCurrency.pl context. Done means $12.35 is accepted, but only after the maintainer agrees on the approach, which the thread has not yet settled.

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

Mô tả

Sometimes when using contextCurrency.pl, there is algebra that leads to a perl decimal version of an answer, and then you pass that decimal to the Currency() constructor to create an answer where students must use a dollar sign.

Sometimes, you are creating an answer like this one: Currency(12.345). And sometimes (depending on what produced that decimal value and whatever machine rounding error may be in play) the correct answer displays as $12.35, but neither $12.35 nor $12.34 will be accepted as correct when a student enters them, using the default tolerance. They are just at the cusp of the decimal tolerance. Also a student may not enter something like $12.345 with the default flags.

Perhaps the problem author should be aware of all this and round their decimals before passing them to the Currency() constructor. But maybe not, since maybe the Currency() object is supposed to retain deeper decimal precision if it gets used in further calculations. So I'm wondering if we could address this by tweaking the cmp method for a Currency object. What I'm thinking is, if the context disallows entering more than two decimal places, the correct answer should be rounded to two decimal places before it is actually compared to the student answer. Would that idea raise any objections? Of course this is something where I'm interested to hear from @dpvc.

Ngôn ngữ chính
Perl
Star
48
Fork
78
Merge trung bình
5 ngày 13 giờ
Pull request đã merge (30 ngày)
9

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 openwebwork/pg

Tất cả issue của openwebwork/pg

Issue tương tự

Thêm issue về Perl

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.