Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#1,503 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
70/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
compilers

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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?

Lingua principale
C#
Stelle
831
Fork
79
Merge medio
2h 22m
PR unite (30g)
507

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ASC-Community/AngouriMath

Tutte le issue di ASC-Community/AngouriMath

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.