Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Upgrading real numbers to complex

Upgrading real numbers to complex

Hello,

I tried to write the following very simple model using OpenModelica 1.9.3

model testComplex
  Complex i;
equation
  i = 0.0;
end testComplex;

This model does not compile, whereas the Complex numbers class does have a constructor based on real numbers, so shouldn't the real number be automatically upgraded to Complex (0.0) ?

Also, the model with 0 (int) instead of 0.0 (real) should probably work.

What do you think ?

Besides, why is the "<>" operator not defined for complex numbers ?

Thank you,
François

Re: Upgrading real numbers to complex

No, the specification only talks about binary and unary operations. The overloaded constructor is not used in equality-equations.

Complex 3.2.2 contains an overloaded '<>'. 3.2.1 does not.

Re: Upgrading real numbers to complex

Ok thank you !

There are 0 guests and 0 other users also viewing this topic
You are here: