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

`3 i` parses as `3 ^ i`: an imaginary literal after a factor is read as its exponent

Đang mở
#1,503 4 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
70/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
compilers

Hướng nghiên cứu

Start with Syntax.md and SyntaxDocumentedTest, which document and pin the current juxtaposition rule. Trace the parser entry point used by ToEntity() and inspect how imaginary literals are classified after a factor. Done means the proposed imaginary-literal cases parse as multiplication, existing power cases remain unchanged, and the documentation test reflects the new rule.

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

Mô tả

3 i parses as 3 ^ i, not 3 * i, so sin(3 i) is evaluated at 3^i (about 0.455 + 0.891i):

"sin(3 i)".ToEntity()   ->  sin(3 ^ i)
"x i".ToEntity()        ->  x ^ i
"(1 + 2) i".ToEntity()  ->  (1 + 2) ^ i
"2 i x".ToEntity()      ->  2 ^ i * x

2.5.0 does the same. The juxtaposition rule inserts ^ before a number written after a number, a name or ), so that x2 is x ^ 2. The lexer reads i as a number, so the rule applies to it as well. Syntax.md records this as a consequence of the rule since #1041, and SyntaxDocumentedTest pins "x i" as "x ^ i".

Proposal: an imaginary literal written after a factor is a factor too. 3 i would be 3 * i and x 2i would be x * 2i, while x2, 3 2 and (x + 1)2 stay powers. 3i, written as one literal, is already 3i. I'd change the rule and the documented row together. Is that the reading you want?

Ngôn ngữ chính
C#
Star
831
Fork
79
Merge trung bình
2 giờ 22 phút
Pull request đã merge (30 ngày)
507

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

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 ASC-Community/AngouriMath

Tất cả issue của ASC-Community/AngouriMath

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.