SNAP Library 4.0, User Reference  2017-07-27 13:18:06
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TFlt Class Reference

#include <dt.h>

Inherited by TAscFlt.

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 1383 of file dt.h.

Constructor & Destructor Documentation

TFlt::TFlt ( )
inline

Definition at line 1395 of file dt.h.

1395 : Val(0){}
double Val
Definition: dt.h:1385
TFlt::TFlt ( const double &  _Val)
inline

Definition at line 1396 of file dt.h.

1396 : Val(_Val){}
double Val
Definition: dt.h:1385
TFlt::TFlt ( TSIn SIn)
inlineexplicit

Definition at line 1398 of file dt.h.

1398 {SIn.Load(Val);}
double Val
Definition: dt.h:1385
void Load(bool &Bool)
Definition: fl.h:84
TFlt::TFlt ( TSIn SIn,
const bool &  IsTxt 
)
inlineexplicit

Definition at line 1400 of file dt.h.

1400  {
1401  if (IsTxt){TStr Str(SIn, true); Val=Str.GetFlt(0);} else {SIn.Load(Val);}}
double Val
Definition: dt.h:1385
void Load(bool &Bool)
Definition: fl.h:84
Definition: dt.h:412

Member Function Documentation

static double TFlt::Abs ( const double &  Flt)
inlinestatic

Definition at line 1427 of file dt.h.

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

Definition at line 1431 of file dt.h.

1431  {
1432  return fabs(LFlt-RFlt)<0.000001;}
static TStr TFlt::GetGigaStr ( const double &  Val)
inlinestatic

Definition at line 1477 of file dt.h.

1477  {
1478  if (fabs(Val)>100*1000000000.0){return TStr::Fmt("%.0fG", Val/1000000000.0);}
1479  else if (fabs(Val)>1000000000.0){return TStr::Fmt("%.1fG", Val/1000000000.0);}
1480  else {return GetMegaStr(Val);}}
double Val
Definition: dt.h:1385
static TStr GetMegaStr(const double &Val)
Definition: dt.h:1473
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
static double TFlt::GetInRng ( const double &  Val,
const double &  Mn,
const double &  Mx 
)
inlinestatic

Definition at line 1448 of file dt.h.

1448  {
1449  IAssert(Mn<=Mx); return Val<Mn?Mn:(Val>Mx?Mx:Val);}
#define IAssert(Cond)
Definition: bd.h:262
double Val
Definition: dt.h:1385
static const double Mx
Definition: dt.h:1388
static const double Mn
Definition: dt.h:1387
static TStr TFlt::GetKiloStr ( const double &  Val)
inlinestatic

Definition at line 1469 of file dt.h.

1469  {
1470  if (fabs(Val)>100*1000){return TStr::Fmt("%.0fK", Val/1000);}
1471  else if (fabs(Val)>1000){return TStr::Fmt("%.1fK", Val/1000);}
1472  else {return TStr::Fmt("%.0f", Val);}}
double Val
Definition: dt.h:1385
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
static TStr TFlt::GetMegaStr ( const double &  Val)
inlinestatic

Definition at line 1473 of file dt.h.

1473  {
1474  if (fabs(Val)>100*1000000){return TStr::Fmt("%.0fM", Val/1000000);}
1475  else if (fabs(Val)>1000000){return TStr::Fmt("%.1fM", Val/1000000);}
1476  else {return GetKiloStr(Val);}}
double Val
Definition: dt.h:1385
static TStr GetKiloStr(const double &Val)
Definition: dt.h:1469
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
int TFlt::GetMemUsed ( ) const
inline

Definition at line 1420 of file dt.h.

1420 {return sizeof(TFlt);}
TFlt()
Definition: dt.h:1395
static double TFlt::GetMn ( const double &  Flt1,
const double &  Flt2 
)
inlinestatic

Definition at line 1434 of file dt.h.

1434  {
1435  return Flt1<Flt2?Flt1:Flt2;}
static double TFlt::GetMn ( const double &  Flt1,
const double &  Flt2,
const double &  Flt3 
)
inlinestatic

Definition at line 1436 of file dt.h.

1436  {
1437  return GetMn(GetMn(Flt1, Flt2), Flt3); }
static double GetMn(const double &Flt1, const double &Flt2)
Definition: dt.h:1434
static double TFlt::GetMn ( const double &  Flt1,
const double &  Flt2,
const double &  Flt3,
const double &  Flt4 
)
inlinestatic

Definition at line 1438 of file dt.h.

1438  {
1439  return GetMn(GetMn(Flt1, Flt2), GetMn(Flt3, Flt4)); }
static double GetMn(const double &Flt1, const double &Flt2)
Definition: dt.h:1434
static double TFlt::GetMx ( const double &  Flt1,
const double &  Flt2 
)
inlinestatic

Definition at line 1441 of file dt.h.

1441  {
1442  return Flt1>Flt2?Flt1:Flt2;}
static double TFlt::GetMx ( const double &  Flt1,
const double &  Flt2,
const double  Flt3 
)
inlinestatic

Definition at line 1443 of file dt.h.

1443  {
1444  return GetMx(GetMx(Flt1, Flt2), Flt3); }
static double GetMx(const double &Flt1, const double &Flt2)
Definition: dt.h:1441
static double TFlt::GetMx ( const double &  Flt1,
const double &  Flt2,
const double  Flt3,
const double &  Flt4 
)
inlinestatic

Definition at line 1445 of file dt.h.

1445  {
1446  return GetMx(GetMx(Flt1, Flt2), GetMx(Flt3, Flt4)); }
static double GetMx(const double &Flt1, const double &Flt2)
Definition: dt.h:1441
static TStr TFlt::GetPrcStr ( const double &  RelVal,
const double &  FullVal 
)
inlinestatic

Definition at line 1466 of file dt.h.

1466  {
1467  return GetStr(100*RelVal/FullVal, "%3.0f%%");}
TStr GetStr() const
Definition: dt.h:1459
int TFlt::GetPrimHashCd ( ) const
inline

Definition at line 1422 of file dt.h.

1422  {
1423  int Expn; return int((frexp(Val, &Expn)-0.5)*double(TInt::Mx));}
static const int Mx
Definition: dt.h:1139
double Val
Definition: dt.h:1385
static double TFlt::GetRnd ( )
inlinestatic

Definition at line 1430 of file dt.h.

1430 {return Rnd.GetUniDev();}
double GetUniDev()
Definition: dt.h:30
static TRnd Rnd
Definition: dt.h:1393
int TFlt::GetSecHashCd ( ) const
inline

Definition at line 1424 of file dt.h.

1424  {
1425  int Expn; frexp(Val, &Expn); return Expn;}
double Val
Definition: dt.h:1385
TStr TFlt::GetStr ( ) const
inline

Definition at line 1459 of file dt.h.

1459 {return TFlt::GetStr(Val);}
double Val
Definition: dt.h:1385
TStr GetStr() const
Definition: dt.h:1459
TStr TFlt::GetStr ( const double &  Val,
const int &  Width = -1,
const int &  Prec = -1 
)
static

Definition at line 2236 of file dt.cpp.

2236  {
2237  char Bf[255];
2238  if ((Width==-1)&&(Prec==-1)){sprintf(Bf, "%g", Val);}
2239  else {sprintf(Bf, "%*.*f", Width, Prec, Val);}
2240  return TStr(Bf);
2241 }
double Val
Definition: dt.h:1385
Definition: dt.h:412
static TStr TFlt::GetStr ( const TFlt Flt,
const int &  Width = -1,
const int &  Prec = -1 
)
inlinestatic

Definition at line 1461 of file dt.h.

1461  {
1462  return GetStr(Flt.Val, Width, Prec);}
double Val
Definition: dt.h:1385
TStr GetStr() const
Definition: dt.h:1459
TStr TFlt::GetStr ( const double &  Val,
const char *  FmtStr 
)
static

Definition at line 2243 of file dt.cpp.

2243  {
2244  if (FmtStr==NULL){
2245  return GetStr(Val);
2246  } else {
2247  char Bf[255];
2248  sprintf(Bf, FmtStr, Val);
2249  return TStr(Bf);
2250  }
2251 }
double Val
Definition: dt.h:1385
Definition: dt.h:412
TStr GetStr() const
Definition: dt.h:1459
static TStr TFlt::GetStr ( const double &  Val,
const TStr FmtStr 
)
inlinestatic

Definition at line 1464 of file dt.h.

1464  {
1465  return GetStr(Val, FmtStr.CStr());}
double Val
Definition: dt.h:1385
TStr GetStr() const
Definition: dt.h:1459
char * CStr()
Definition: dt.h:476
static bool TFlt::IsNan ( const double &  Val)
inlinestatic

Definition at line 1453 of file dt.h.

1453  {
1454  return (Val!=Val);}
double Val
Definition: dt.h:1385
bool TFlt::IsNan ( ) const
inline

Definition at line 1457 of file dt.h.

1457 { return IsNan(Val); }
double Val
Definition: dt.h:1385
bool IsNan() const
Definition: dt.h:1457
static bool TFlt::IsNum ( const double &  Val)
inlinestatic

Definition at line 1451 of file dt.h.

1451  {
1452  return (Mn<=Val)&&(Val<=Mx);}
double Val
Definition: dt.h:1385
static const double Mx
Definition: dt.h:1388
static const double Mn
Definition: dt.h:1387
bool TFlt::IsNum ( ) const
inline

Definition at line 1456 of file dt.h.

1456 { return IsNum(Val); }
double Val
Definition: dt.h:1385
bool IsNum() const
Definition: dt.h:1456
void TFlt::Load ( TSIn SIn)
inline

Definition at line 1402 of file dt.h.

1402 {SIn.Load(Val);}
double Val
Definition: dt.h:1385
void Load(bool &Bool)
Definition: fl.h:84
void TFlt::LoadXml ( const PXmlTok XmlTok,
const TStr Nm 
)

Definition at line 2227 of file dt.cpp.

2227  {
2228  XLoadHd(Nm);
2229  Val=TXmlObjSer::GetFltArg(XmlTok, "Val");
2230 }
#define XLoadHd(Nm)
Definition: bd.h:312
double Val
Definition: dt.h:1385
static double GetFltArg(const PXmlTok &XmlTok, const TStr &Nm)
Definition: xml.cpp:104
TFlt::operator double ( ) const
inline

Definition at line 1397 of file dt.h.

1397 {return Val;}
double Val
Definition: dt.h:1385
bool TFlt::operator!= ( const double &  Flt) const
inline

Definition at line 1412 of file dt.h.

1412 {return Val!=Flt;}
double Val
Definition: dt.h:1385
double TFlt::operator() ( ) const
inline

Definition at line 1413 of file dt.h.

1413 {return Val;}
double Val
Definition: dt.h:1385
TFlt& TFlt::operator*= ( const double &  Flt)
inline

Definition at line 1416 of file dt.h.

1416 {Val*=Flt; return *this;}
double Val
Definition: dt.h:1385
TFlt TFlt::operator++ ( int  )
inline

Definition at line 1418 of file dt.h.

1418 {Val++; return *this;}
double Val
Definition: dt.h:1385
TFlt& TFlt::operator+= ( const double &  Flt)
inline

Definition at line 1414 of file dt.h.

1414 {Val+=Flt; return *this;}
double Val
Definition: dt.h:1385
TFlt TFlt::operator-- ( int  )
inline

Definition at line 1419 of file dt.h.

1419 {Val--; return *this;}
double Val
Definition: dt.h:1385
TFlt& TFlt::operator-= ( const double &  Flt)
inline

Definition at line 1415 of file dt.h.

1415 {Val-=Flt; return *this;}
double Val
Definition: dt.h:1385
TFlt& TFlt::operator/= ( const double &  Flt)
inline

Definition at line 1417 of file dt.h.

1417 {Val/=Flt; return *this;}
double Val
Definition: dt.h:1385
TFlt& TFlt::operator= ( const TFlt Flt)
inline

Definition at line 1408 of file dt.h.

1408 {Val=Flt.Val; return *this;}
double Val
Definition: dt.h:1385
TFlt& TFlt::operator= ( const double &  Flt)
inline

Definition at line 1409 of file dt.h.

1409 {Val=Flt; return *this;}
double Val
Definition: dt.h:1385
bool TFlt::operator== ( const TFlt Flt) const
inline

Definition at line 1410 of file dt.h.

1410 {return Val==Flt.Val;}
double Val
Definition: dt.h:1385
bool TFlt::operator== ( const double &  Flt) const
inline

Definition at line 1411 of file dt.h.

1411 {return Val==Flt;}
double Val
Definition: dt.h:1385
static int TFlt::Round ( const double &  Flt)
inlinestatic

Definition at line 1429 of file dt.h.

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

Definition at line 1399 of file dt.h.

1399 {SOut.Save(Val);}
double Val
Definition: dt.h:1385
void Save(const bool &Bool)
Definition: fl.h:173
void TFlt::Save ( TSOut SOut,
const bool &  IsTxt 
) const
inline

Definition at line 1403 of file dt.h.

1403  {
1404  if (IsTxt){GetStr(Val).Save(SOut, true);} else {SOut.Save(Val);}}
double Val
Definition: dt.h:1385
void Save(TSOut &SOut, const bool &IsSmall=false) const
Definition: dt.h:440
void Save(const bool &Bool)
Definition: fl.h:173
TStr GetStr() const
Definition: dt.h:1459
void TFlt::SaveXml ( TSOut SOut,
const TStr Nm 
) const

Definition at line 2232 of file dt.cpp.

2232  {
2233  XSaveBETagArg(Nm, "Val", TFlt::GetStr(Val));
2234 }
#define XSaveBETagArg(Nm, ArgNm, ArgVal)
Definition: bd.h:327
double Val
Definition: dt.h:1385
TStr GetStr() const
Definition: dt.h:1459
static int TFlt::Sign ( const double &  Flt)
inlinestatic

Definition at line 1428 of file dt.h.

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

Member Data Documentation

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

Definition at line 1391 of file dt.h.

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

Definition at line 1392 of file dt.h.

const double TFlt::Mn =-DBL_MAX
static

Definition at line 1387 of file dt.h.

const double TFlt::Mx =+DBL_MAX
static

Definition at line 1388 of file dt.h.

const double TFlt::NInf =-DBL_MAX
static

Definition at line 1389 of file dt.h.

const double TFlt::PInf =+DBL_MAX
static

Definition at line 1390 of file dt.h.

TRnd TFlt::Rnd
static

Definition at line 1393 of file dt.h.

double TFlt::Val

Definition at line 1385 of file dt.h.


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