oppiliappan / eva

a calculator REPL, similar to bc(1)
MIT License
814 stars 29 forks source link

Suggestion: Complex numbers #1

Open KSXGitHub opened 5 years ago

KSXGitHub commented 5 years ago

ln(-1) = πi

sqrt(-4) = 2i

oppiliappan commented 5 years ago

complex numbers would really complete the calculator idea, but i will be giving this a lower priority, simply because i dont quite see complex numbers being used in everyday calculations, and functions such as ln would have to be rewritten to support complex numbers.

(-1_f64.ln() returns 0)

KSXGitHub commented 5 years ago

functions such as ln would have to be rewritten to support complex numbers.

You may not have to. Have you ever heard of nalgebra?

oppiliappan commented 5 years ago

wew thats a lot more detailed than i imagined! i will look into it an try implementing complex numbers.

i hope it isint too hard to figure out :^)

KSXGitHub commented 5 years ago

i will look into it an try implementing complex numbers.

i hope it isint too hard to figure out :^)

Why would you want to implement complex numbers yourself? The crate that I pointed you to already has it. You only need to use it.

oppiliappan commented 5 years ago

A lot of the lexing logic would have to be modified to accept complex inputs. currently alphabetical inputs only contribute to alphabets used in functions. this would have to be changed to detect iota etc.

once again, i have only taken a glance at the library and its capabilities, ill get to work when i get some time on my hands!

KSXGitHub commented 5 years ago

A lot of the lexing logic would have to be modified to accept complex inputs

You don't have to accept complex inputs now. What I asked is to display complex output.

Jackojc commented 5 years ago

You're being a bit pushy, this guy is developing the project in his own time out of his own free will and you're kind of coming across a bit aggressively.

KSXGitHub commented 5 years ago

@Jackojc You think you know what others think?

oppiliappan commented 5 years ago

ahaha slow down a bit friendos!

this thread is for discussions related to the program. do not make personal jabs, or instigate other users / contributors.

that being said, i request @KSXGitHub to be more polite. Let all further discussion be constructive!