Native complex numbers


#1

Hello,

any idea to implement native complex numbers in uLisp?
I suppose the standard syntax #C(0 1) (i.e. imaginary unit) should be quite ok with the existing parser (I was thinking about the reader macros and change of base part of source code).

I’m still trying to understand the parsing, I’m not so experienced C programmer, so maybe if it’s something not feasible, sorry for that.

What do you think?

regards,
Fausto


#2

Have a look at this application, which shows one way of doing it:

Fast Fourier Transform


#3

I’d guess there is C-level support for complex numbers on the higher end of what uLisp works on.

I don’t think libc-avr has any, though.

In any case, I think supporting complex numbers as thoroughly as Common Lisp does is what they call “non-trivial”, especially on the machines uLisp targets.


#4

This is a very nice example, and it’s working perfectly.
Anyway, having them as native type can be useful for the performance with all the related operations.