You are here

public function Complex::__toString in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/unitTests/custom/Complex.php \Complex::__toString()

File

vendor/phpoffice/phpexcel/unitTests/custom/Complex.php, line 95

Class

Complex

Code

public function __toString() {
  $str = "";
  if ($this->imaginaryPart != 0.0) {
    if (abs($this->imaginaryPart) != 1.0) {
      $str .= $this->imaginaryPart . $this->suffix;
    }
    else {
      $str .= ($this->imaginaryPart < 0.0 ? '-' : '') . $this->suffix;
    }
  }
  if ($this->realPart != 0.0) {
    if ($str && $this->imaginaryPart > 0.0) {
      $str = "+" . $str;
    }
    $str = $this->realPart . $str;
  }
  if (!$str) {
    $str = "0.0";
  }
  return $str;
}