SNAP Library 2.2, User Reference  2014-03-11 19:15:55
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TFlt Class Reference

#include <dt.h>

Inherited by TAscFlt.

List of all members.

Public Member Functions

 TFlt ()
 TFlt (const double &_Val)
 operator double () const
 TFlt (TSIn &SIn)
void Save (TSOut &SOut) const
 TFlt (TSIn &SIn, const bool &IsTxt)
void Load (TSIn &SIn)
void Save (TSOut &SOut, const bool &IsTxt) const
void LoadXml (const PXmlTok &XmlTok, const TStr &Nm)
void SaveXml (TSOut &SOut, const TStr &Nm) const
TFltoperator= (const TFlt &Flt)
TFltoperator= (const double &Flt)
bool operator== (const TFlt &Flt) const _CMPWARN
bool operator== (const double &Flt) const _CMPWARN
bool operator!= (const double &Flt) const _CMPWARN
double operator() () const
TFltoperator+= (const double &Flt)
TFltoperator-= (const double &Flt)
TFltoperator*= (const double &Flt)
TFltoperator/= (const double &Flt)
TFlt operator++ (int)
TFlt operator-- (int)
int GetMemUsed () const
int GetPrimHashCd () const
int GetSecHashCd () const
bool IsNum () const
bool IsNan () const
TStr GetStr () const

Static Public Member Functions

static double Abs (const double &Flt)
static int Sign (const double &Flt)
static int Round (const double &Flt)
static double GetRnd ()
static bool Eq6 (const double &LFlt, const double &RFlt)
static double GetMn (const double &Flt1, const double &Flt2)
static double GetMn (const double &Flt1, const double &Flt2, const double &Flt3)
static double GetMn (const double &Flt1, const double &Flt2, const double &Flt3, const double &Flt4)
static double GetMx (const double &Flt1, const double &Flt2)
static double GetMx (const double &Flt1, const double &Flt2, const double Flt3)
static double GetMx (const double &Flt1, const double &Flt2, const double Flt3, const double &Flt4)
static double GetInRng (const double &Val, const double &Mn, const double &Mx)
static bool IsNum (const double &Val)
static bool IsNan (const double &Val)
static TStr GetStr (const double &Val, const int &Width=-1, const int &Prec=-1)
static TStr GetStr (const TFlt &Flt, const int &Width=-1, const int &Prec=-1)
static TStr GetStr (const double &Val, const char *FmtStr)
static TStr GetStr (const double &Val, const TStr &FmtStr)
static TStr GetPrcStr (const double &RelVal, const double &FullVal)
static TStr GetKiloStr (const double &Val)
static TStr GetMegaStr (const double &Val)
static TStr GetGigaStr (const double &Val)

Public Attributes

double Val

Static Public Attributes

static const double Mn = -DBL_MAX
static const double Mx = +DBL_MAX
static const double NInf = -DBL_MAX
static const double PInf = +DBL_MAX
static const double Eps = 1e-16
static const double EpsHalf = 1e-7
static TRnd Rnd

Detailed Description

Definition at line 1289 of file dt.h.


Constructor & Destructor Documentation

TFlt::TFlt ( ) [inline]

Definition at line 1301 of file dt.h.

: Val(0){}
TFlt::TFlt ( const double &  _Val) [inline]

Definition at line 1302 of file dt.h.

: Val(_Val){}
TFlt::TFlt ( TSIn SIn) [inline, explicit]

Definition at line 1304 of file dt.h.

{SIn.Load(Val);}
TFlt::TFlt ( TSIn SIn,
const bool &  IsTxt 
) [inline, explicit]

Definition at line 1306 of file dt.h.

                                             {
    if (IsTxt){TStr Str(SIn, true); Val=Str.GetFlt(0);} else {SIn.Load(Val);}}

Member Function Documentation

static double TFlt::Abs ( const double &  Flt) [inline, static]

Definition at line 1333 of file dt.h.

{return Flt<0?-Flt:Flt;}
static bool TFlt::Eq6 ( const double &  LFlt,
const double &  RFlt 
) [inline, static]

Definition at line 1337 of file dt.h.

                                                         {
    return fabs(LFlt-RFlt)<0.000001;}
static TStr TFlt::GetGigaStr ( const double &  Val) [inline, static]

Definition at line 1383 of file dt.h.

                                           {
    if (fabs(Val)>100*1000000000.0){return TStr::Fmt("%.0fG", Val/1000000000.0);}
    else if (fabs(Val)>1000000000.0){return TStr::Fmt("%.1fG", Val/1000000000.0);}
    else {return GetMegaStr(Val);}}
static double TFlt::GetInRng ( const double &  Val,
const double &  Mn,
const double &  Mx 
) [inline, static]

Definition at line 1354 of file dt.h.

                                                                               {
    IAssert(Mn<=Mx); return Val<Mn?Mn:(Val>Mx?Mx:Val);}
static TStr TFlt::GetKiloStr ( const double &  Val) [inline, static]

Definition at line 1375 of file dt.h.

                                           {
    if (fabs(Val)>100*1000){return TStr::Fmt("%.0fK", Val/1000);}
    else if (fabs(Val)>1000){return TStr::Fmt("%.1fK", Val/1000);}
    else {return TStr::Fmt("%.0f", Val);}}
static TStr TFlt::GetMegaStr ( const double &  Val) [inline, static]

Definition at line 1379 of file dt.h.

                                           {
    if (fabs(Val)>100*1000000){return TStr::Fmt("%.0fM", Val/1000000);}
    else if (fabs(Val)>1000000){return TStr::Fmt("%.1fM", Val/1000000);}
    else {return GetKiloStr(Val);}}
int TFlt::GetMemUsed ( ) const [inline]

Definition at line 1326 of file dt.h.

{return sizeof(TFlt);}
static double TFlt::GetMn ( const double &  Flt1,
const double &  Flt2 
) [inline, static]

Definition at line 1340 of file dt.h.

                                                             {
    return Flt1<Flt2?Flt1:Flt2;}
static double TFlt::GetMn ( const double &  Flt1,
const double &  Flt2,
const double &  Flt3 
) [inline, static]

Definition at line 1342 of file dt.h.

                                                                                 {
    return GetMn(GetMn(Flt1, Flt2), Flt3); }
static double TFlt::GetMn ( const double &  Flt1,
const double &  Flt2,
const double &  Flt3,
const double &  Flt4 
) [inline, static]

Definition at line 1344 of file dt.h.

                                                                                                     {
    return GetMn(GetMn(Flt1, Flt2), GetMn(Flt3, Flt4)); }
static double TFlt::GetMx ( const double &  Flt1,
const double &  Flt2 
) [inline, static]

Definition at line 1347 of file dt.h.

                                                             {
    return Flt1>Flt2?Flt1:Flt2;}
static double TFlt::GetMx ( const double &  Flt1,
const double &  Flt2,
const double  Flt3 
) [inline, static]

Definition at line 1349 of file dt.h.

                                                                                {
    return GetMx(GetMx(Flt1, Flt2), Flt3); }
static double TFlt::GetMx ( const double &  Flt1,
const double &  Flt2,
const double  Flt3,
const double &  Flt4 
) [inline, static]

Definition at line 1351 of file dt.h.

                                                                                                    {
    return GetMx(GetMx(Flt1, Flt2), GetMx(Flt3, Flt4)); }
static TStr TFlt::GetPrcStr ( const double &  RelVal,
const double &  FullVal 
) [inline, static]

Definition at line 1372 of file dt.h.

                                                                    {
    return GetStr(100*RelVal/FullVal, "%3.0f%%");}
int TFlt::GetPrimHashCd ( ) const [inline]

Definition at line 1328 of file dt.h.

                            {
    int Expn; return int((frexp(Val, &Expn)-0.5)*double(TInt::Mx));}
static double TFlt::GetRnd ( ) [inline, static]

Definition at line 1336 of file dt.h.

{return Rnd.GetUniDev();}
int TFlt::GetSecHashCd ( ) const [inline]

Definition at line 1330 of file dt.h.

                           {
    int Expn; frexp(Val, &Expn); return Expn;}
TStr TFlt::GetStr ( ) const [inline]

Definition at line 1365 of file dt.h.

{return TFlt::GetStr(Val);}
TStr TFlt::GetStr ( const double &  Val,
const int &  Width = -1,
const int &  Prec = -1 
) [static]

Definition at line 2236 of file dt.cpp.

                                                                     {
  char Bf[255];
  if ((Width==-1)&&(Prec==-1)){sprintf(Bf, "%g", Val);}
  else {sprintf(Bf, "%*.*f", Width, Prec, Val);}
  return TStr(Bf);
}
static TStr TFlt::GetStr ( const TFlt Flt,
const int &  Width = -1,
const int &  Prec = -1 
) [inline, static]

Definition at line 1367 of file dt.h.

                                                                              {
    return GetStr(Flt.Val, Width, Prec);}
TStr TFlt::GetStr ( const double &  Val,
const char *  FmtStr 
) [static]

Definition at line 2243 of file dt.cpp.

                                                      {
  if (FmtStr==NULL){
    return GetStr(Val);
  } else {
    char Bf[255];
    sprintf(Bf, FmtStr, Val);
    return TStr(Bf);
  }
}
static TStr TFlt::GetStr ( const double &  Val,
const TStr FmtStr 
) [inline, static]

Definition at line 1370 of file dt.h.

                                                           {
    return GetStr(Val, FmtStr.CStr());}
static bool TFlt::IsNan ( const double &  Val) [inline, static]

Definition at line 1359 of file dt.h.

                                      {
    return (Val!=Val);}
bool TFlt::IsNan ( ) const [inline]

Definition at line 1363 of file dt.h.

{ return IsNan(Val); }
static bool TFlt::IsNum ( const double &  Val) [inline, static]

Definition at line 1357 of file dt.h.

                                      {
    return (Mn<=Val)&&(Val<=Mx);}
bool TFlt::IsNum ( ) const [inline]

Definition at line 1362 of file dt.h.

{ return IsNum(Val); }
void TFlt::Load ( TSIn SIn) [inline]

Definition at line 1308 of file dt.h.

{SIn.Load(Val);}
void TFlt::LoadXml ( const PXmlTok XmlTok,
const TStr Nm 
)

Definition at line 2227 of file dt.cpp.

                                                       {
  XLoadHd(Nm);
  Val=TXmlObjSer::GetFltArg(XmlTok, "Val");
}
TFlt::operator double ( ) const [inline]

Definition at line 1303 of file dt.h.

{return Val;}
bool TFlt::operator!= ( const double &  Flt) const [inline]

Definition at line 1318 of file dt.h.

{return Val!=Flt;}
double TFlt::operator() ( ) const [inline]

Definition at line 1319 of file dt.h.

{return Val;}
TFlt& TFlt::operator*= ( const double &  Flt) [inline]

Definition at line 1322 of file dt.h.

{Val*=Flt; return *this;}
TFlt TFlt::operator++ ( int  ) [inline]

Definition at line 1324 of file dt.h.

{Val++; return *this;}
TFlt& TFlt::operator+= ( const double &  Flt) [inline]

Definition at line 1320 of file dt.h.

{Val+=Flt; return *this;}
TFlt TFlt::operator-- ( int  ) [inline]

Definition at line 1325 of file dt.h.

{Val--; return *this;}
TFlt& TFlt::operator-= ( const double &  Flt) [inline]

Definition at line 1321 of file dt.h.

{Val-=Flt; return *this;}
TFlt& TFlt::operator/= ( const double &  Flt) [inline]

Definition at line 1323 of file dt.h.

{Val/=Flt; return *this;}
TFlt& TFlt::operator= ( const TFlt Flt) [inline]

Definition at line 1314 of file dt.h.

{Val=Flt.Val; return *this;}
TFlt& TFlt::operator= ( const double &  Flt) [inline]

Definition at line 1315 of file dt.h.

{Val=Flt; return *this;}
bool TFlt::operator== ( const TFlt Flt) const [inline]

Definition at line 1316 of file dt.h.

{return Val==Flt.Val;}
bool TFlt::operator== ( const double &  Flt) const [inline]

Definition at line 1317 of file dt.h.

{return Val==Flt;}
static int TFlt::Round ( const double &  Flt) [inline, static]

Definition at line 1335 of file dt.h.

{return int(floor(Flt+0.5));}
void TFlt::Save ( TSOut SOut) const [inline]

Reimplemented in TAscFlt.

Definition at line 1305 of file dt.h.

{SOut.Save(Val);}
void TFlt::Save ( TSOut SOut,
const bool &  IsTxt 
) const [inline]

Definition at line 1309 of file dt.h.

                                                  {
    if (IsTxt){GetStr(Val).Save(SOut, true);} else {SOut.Save(Val);}}
void TFlt::SaveXml ( TSOut SOut,
const TStr Nm 
) const

Definition at line 2232 of file dt.cpp.

                                                    {
  XSaveBETagArg(Nm, "Val", TFlt::GetStr(Val));
}
static int TFlt::Sign ( const double &  Flt) [inline, static]

Definition at line 1334 of file dt.h.

{return Flt<0?-1:(Flt>0?1:0);}

Member Data Documentation

const double TFlt::Eps = 1e-16 [static]

Definition at line 1297 of file dt.h.

const double TFlt::EpsHalf = 1e-7 [static]

Definition at line 1298 of file dt.h.

const double TFlt::Mn = -DBL_MAX [static]

Definition at line 1293 of file dt.h.

const double TFlt::Mx = +DBL_MAX [static]

Definition at line 1294 of file dt.h.

const double TFlt::NInf = -DBL_MAX [static]

Definition at line 1295 of file dt.h.

const double TFlt::PInf = +DBL_MAX [static]

Definition at line 1296 of file dt.h.

TRnd TFlt::Rnd [static]

Definition at line 1299 of file dt.h.

double TFlt::Val

Definition at line 1291 of file dt.h.


The documentation for this class was generated from the following files: