<commit_before>// @(#)root/mathcore:$Id$
// Author: <NAME>   22/04/2004

/*************************************************************************
 * Copyright (C) 1995-2004, <NAME> and <NAME>.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TComplex                                                             //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TComplex.h"
#include "Riostream.h"


ClassImp(TComplex)

//______________________________________________________________________________
TComplex::TComplex(Double_t re, Double_t im, Bool_t polar) : fRe(re), fIm(im)
{
   // Standard constructor

   if (polar) {
      fRe=re*TMath::Cos(im);
      fIm=re*TMath::Sin(im);
   }
}

//______________________________________________________________________________
ostream& operator<<(ostream& out, const TComplex& c)
{
   out << "(" << c.fRe << "," << c.fIm << "i)";
   return out;
}
<commit_msg>From Federico: Protect against a negative real value and issue a warning. Fix <http://savannah.cern.ch/bugs/?39919><commit_after>// @(#)root/mathcore:$Id$
// Author: <NAME>   22/04/2004

/*************************************************************************
 * Copyright (C) 1995-2004, <NAME> and <NAME>.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TComplex                                                             //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TComplex.h"
#include "Riostream.h"


ClassImp(TComplex)

//______________________________________________________________________________
TComplex::TComplex(Double_t re, Double_t im, Bool_t polar) : fRe(re), fIm(im)
{
   // Standard constructor

   if (polar) {
      if(re<0) {
         ::Warning("TComplex::ctor","Modulo of a complex number should be >=0, taking the abs");
         re=-re;
      }
      fRe=re*TMath::Cos(im);
      fIm=re*TMath::Sin(im);
   }
}

//______________________________________________________________________________
ostream& operator<<(ostream& out, const TComplex& c)
{
   out << "(" << c.fRe << "," << c.fIm << "i)";
   return out;
}

{'fraction_non_alphanumeric': 0.2772852338734332, 'fraction_numerical': 0.011922959339651483, 'mean_word_length': 1.2487972508591065, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7564297', 'n_tokens_mistral': 716, 'n_tokens_neox': 647, 'n_words': 144}