Hi
Can I use complex numbers in mikroC? How would I go about using complex numbers? i.e a + b*I where I=sqrt(-1) is this possible? I am new to programming and really need help
Complex numer
Re: Complex numer
I would like to know that too ! My research is dependent in Transfer Functions who extensally use complex numbers
Re: Complex numbers
There's not built-in supply for complex numbers in MikroC (or in any standard C compiler for that matter). But you can always write your own functions that take real and imaginary part (a and b in your example) and perform the calculations according to textbook rules for imaginary numbers. Storage for complex numbers is easy - just use two float variables, one holding the real part and one the imaginary part. Also I'm sure a web search will turn up plenty of code examples in ANSI C. You may want to define a struct for easier handling.
Last edited by womai on 19 Jul 2010 08:51, edited 1 time in total.
Re: Complex numer
Here is a link to ANSI C routines for complex numbers. That should be easy to adapt for MikroC (if there are any changes required at all - I haven't tried it):
http://www.phanderson.com/complex/index.html
Regards,
Wolfgang
http://www.phanderson.com/complex/index.html
Regards,
Wolfgang
- slavisa.zlatanovic
- mikroElektronika team
- Posts: 1321
- Joined: 07 Apr 2009 09:39
Re: Complex numer
Hi!
Just to confirm that I agree with womai on this subject.
Regards
Slavisa
Just to confirm that I agree with womai on this subject.
Regards
Slavisa
Best regards
Slavisa
Slavisa