简体   繁体   中英

Why is MatLab making a real number complex?

I'm a little confused by what MatLab is doing here ... why does multiplying a real expression by a real constant suddenly make it complex?

x = -1.1451e+02 - 1.1317e+02i;
x*conj(x)

>> 2.5920e+04

10*x*conj(x)

>> 2.5920e+05 - 1.4552e-11i

It is definitely a rounding error. Note that if you add parentheses, your results change:

>> 10 * (x * conj(x));

ans =

   2.5920e+05

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM