Implicit conversion from boolean expression

A boolean expression is used where an expression of another type is expected. Example:

complex z = (x > 3)

The expression (x > 3) returns true or false, depending on the value of x. But only complex values can be assigned to z, so this boolean value is be converted to a complex value: (1,0) if true, (0,0) if false.

This kind of expressions is frequently used in some old Fractint formulas, but it is ambiguous and can lead to many mistakes. Also, it's not very efficient.

It can be solved in two ways. If z actually is used as a boolean variable, a much more efficient solution is the following:

bool z = (x > 3)

However, if z is meant as a complex variable and it needs to receive the value (1,0), the recommended solution is the following:

if (x > 3)
  z = 1
else
  z = 0
endif

See Also
Warnings