Changeset 937de98 in mainline
- Timestamp:
- 2018-07-05T21:41:24Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a4b8b28
- Parents:
- 25709c3
- git-author:
- Dzejrou <dzejrou@…> (2018-05-15 15:44:18)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:24)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/impl/complex.hpp
r25709c3 r937de98 31 31 32 32 #include <iosfwd> 33 #include <sstream> 33 34 34 35 namespace std … … 51 52 template<class U> 52 53 constexpr complex(const complex<U>& other) 53 : real_(other.real _), imag_(other.imag_)54 : real_(other.real()), imag_(other.imag()) 54 55 { /* DUMMY BODY */ } 55 56 … … 150 151 complex& operator*=(const complex<U>& rhs) 151 152 { 153 auto old_real = real_; 152 154 real_ = real_ * rhs.real_ - imag_ * rhs.imag_; 153 imag_ = real_ * rhs.imag_ -imag_ * rhs.real_;155 imag_ = old_real * rhs.imag_ + imag_ * rhs.real_; 154 156 155 157 return *this; … … 159 161 complex& operator/=(const complex<U>& rhs) 160 162 { 163 auto old_real = real_; 161 164 real_ = (real_ * rhs.real_ + imag_ * rhs.imag_) 162 165 / (rhs.real_ * rhs.real_ + rhs.imag_ * rhs.imag_); 163 imag_ = (imag_ * rhs.real_ - real_* rhs.imag_)166 imag_ = (imag_ * rhs.real_ - old_real * rhs.imag_) 164 167 / (rhs.real_ * rhs.real_ + rhs.imag_ * rhs.imag_); 165 168 … … 189 192 template<class U> 190 193 constexpr complex(const complex<U>& other) 191 : real_(other.real _), imag_(other.imag_)194 : real_(other.real()), imag_(other.imag()) 192 195 { /* DUMMY BODY */ } 193 196 … … 288 291 complex& operator*=(const complex<U>& rhs) 289 292 { 293 auto old_real = real_; 290 294 real_ = real_ * rhs.real_ - imag_ * rhs.imag_; 291 imag_ = real_ * rhs.imag_ -imag_ * rhs.real_;295 imag_ = old_real * rhs.imag_ + imag_ * rhs.real_; 292 296 293 297 return *this; … … 297 301 complex& operator/=(const complex<U>& rhs) 298 302 { 303 auto old_real = real_; 299 304 real_ = (real_ * rhs.real_ + imag_ * rhs.imag_) 300 305 / (rhs.real_ * rhs.real_ + rhs.imag_ * rhs.imag_); 301 imag_ = (imag_ * rhs.real_ - real_* rhs.imag_)306 imag_ = (imag_ * rhs.real_ - old_real * rhs.imag_) 302 307 / (rhs.real_ * rhs.real_ + rhs.imag_ * rhs.imag_); 303 308 … … 327 332 template<class U> 328 333 constexpr complex(const complex<U>& other) 329 : real_(other.real _), imag_(other.imag_)334 : real_(other.real()), imag_(other.imag()) 330 335 { /* DUMMY BODY */ } 331 336 … … 426 431 complex& operator*=(const complex<U>& rhs) 427 432 { 433 auto old_real = real_; 428 434 real_ = real_ * rhs.real_ - imag_ * rhs.imag_; 429 imag_ = real_ * rhs.imag_ -imag_ * rhs.real_;435 imag_ = old_real * rhs.imag_ + imag_ * rhs.real_; 430 436 431 437 return *this; … … 435 441 complex& operator/=(const complex<U>& rhs) 436 442 { 443 auto old_real = real_; 437 444 real_ = (real_ * rhs.real_ + imag_ * rhs.imag_) 438 445 / (rhs.real_ * rhs.real_ + rhs.imag_ * rhs.imag_); 439 imag_ = (imag_ * rhs.real_ - real_* rhs.imag_)446 imag_ = (imag_ * rhs.real_ - old_real * rhs.imag_) 440 447 / (rhs.real_ * rhs.real_ + rhs.imag_ * rhs.imag_); 441 448 … … 465 472 template<class U> 466 473 constexpr complex(const complex<U>& other) 467 : real_(other.real _), imag_(other.imag_)474 : real_(other.real()), imag_(other.imag()) 468 475 { /* DUMMY BODY */ } 469 476 … … 564 571 complex& operator*=(const complex<U>& rhs) 565 572 { 573 auto old_real = real_; 566 574 real_ = real_ * rhs.real_ - imag_ * rhs.imag_; 567 imag_ = real_ * rhs.imag_ -imag_ * rhs.real_;575 imag_ = old_real * rhs.imag_ + imag_ * rhs.real_; 568 576 569 577 return *this; … … 573 581 complex& operator/=(const complex<U>& rhs) 574 582 { 583 auto old_real = real_; 575 584 real_ = (real_ * rhs.real_ + imag_ * rhs.imag_) 576 585 / (rhs.real_ * rhs.real_ + rhs.imag_ * rhs.imag_); 577 imag_ = (imag_ * rhs.real_ - real_* rhs.imag_)586 imag_ = (imag_ * rhs.real_ - old_real* rhs.imag_) 578 587 / (rhs.real_ * rhs.real_ + rhs.imag_ * rhs.imag_); 579 588
Note:
See TracChangeset
for help on using the changeset viewer.