Working with complex numbers in C-Script block

Hi,

I’m trying to make complex numbers operations in a C-Script in my model, but when i try to compile the next error is shown:

source:78:38: error: imaginary constants are an extension

I’m including the file “complex.h”, and I defined the numbers as a + b * I for example.

Have anyone worked with complex numbers and succesfully compiled the C-Script?

Best regards,

Sebastián Neira.

1 Like

Hi,you can work around the extension error by defining your own imaginary constant:

const double complex i = csqrt(-1);

However, depending on your operating system you’ll most likely see other errors later. In short, we do not support complex calculations in C-Scripts at this time, but we’ll see whether this can be improved in a later release.Kind regards,Oliver Schwartz