Static Value-Flow Analysis
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
SVF::BoundedDouble Class Reference

#include <NumericValue.h>

Public Member Functions

 BoundedDouble (double fVal)
 
 BoundedDouble (const BoundedDouble &rhs)
 
BoundedDoubleoperator= (const BoundedDouble &rhs)
 
 BoundedDouble (BoundedDouble &&rhs)
 
BoundedDoubleoperator= (BoundedDouble &&rhs)
 
virtual ~BoundedDouble ()
 
const double getFVal () const
 
bool is_plus_infinity () const
 
bool is_minus_infinity () const
 
bool is_infinity () const
 
void set_plus_infinity ()
 
void set_minus_infinity ()
 
bool is_zero () const
 
bool equal (const BoundedDouble &rhs) const
 
bool leq (const BoundedDouble &rhs) const
 
bool geq (const BoundedDouble &rhs) const
 
bool is_int () const
 
bool is_real () const
 
bool is_true () const
 
s64_t getNumeral () const
 Return Numeral. More...
 
s64_t getIntNumeral () const
 
double getRealNumeral () const
 
virtual const std::string to_string () const
 

Static Public Member Functions

static bool doubleEqual (double a, double b)
 
static BoundedDouble plus_infinity ()
 
static BoundedDouble minus_infinity ()
 
static bool isZero (const BoundedDouble &expr)
 
static double safeAdd (double lhs, double rhs)
 
static double safeMul (double lhs, double rhs)
 
static double safeDiv (double lhs, double rhs)
 
static BoundedDouble min (std::vector< BoundedDouble > &_l)
 
static BoundedDouble max (std::vector< BoundedDouble > &_l)
 

Protected Member Functions

 BoundedDouble ()=default
 

Protected Attributes

double _fVal
 

Friends

BoundedDouble operator== (const BoundedDouble &lhs, const BoundedDouble &rhs)
 Reload operator. More...
 
BoundedDouble operator!= (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble operator> (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble operator< (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble operator<= (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble operator>= (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble operator+ (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble operator- (const BoundedDouble &lhs)
 
BoundedDouble operator- (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble operator* (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble operator/ (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble operator% (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble operator^ (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble operator& (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble operator| (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble operator&& (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble operator|| (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble operator! (const BoundedDouble &lhs)
 
BoundedDouble operator>> (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble operator<< (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble ite (const BoundedDouble &cond, const BoundedDouble &lhs, const BoundedDouble &rhs)
 
std::ostream & operator<< (std::ostream &out, const BoundedDouble &expr)
 
bool eq (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble min (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble max (const BoundedDouble &lhs, const BoundedDouble &rhs)
 
BoundedDouble abs (const BoundedDouble &lhs)
 

Detailed Description

Bounded double numeric value

Definition at line 723 of file NumericValue.h.

Constructor & Destructor Documentation

◆ BoundedDouble() [1/4]

SVF::BoundedDouble::BoundedDouble ( )
protecteddefault

◆ BoundedDouble() [2/4]

SVF::BoundedDouble::BoundedDouble ( double  fVal)
inline

Definition at line 731 of file NumericValue.h.

731 : _fVal(fVal) {}

◆ BoundedDouble() [3/4]

SVF::BoundedDouble::BoundedDouble ( const BoundedDouble rhs)
inline

Definition at line 733 of file NumericValue.h.

733 : _fVal(rhs._fVal) {}

◆ BoundedDouble() [4/4]

SVF::BoundedDouble::BoundedDouble ( BoundedDouble &&  rhs)
inline

Definition at line 741 of file NumericValue.h.

741 : _fVal(std::move(rhs._fVal)) {}
constexpr std::remove_reference< T >::type && move(T &&t) noexcept
Definition: SVFUtil.h:447

◆ ~BoundedDouble()

virtual SVF::BoundedDouble::~BoundedDouble ( )
inlinevirtual

Definition at line 749 of file NumericValue.h.

749 {}

Member Function Documentation

◆ doubleEqual()

static bool SVF::BoundedDouble::doubleEqual ( double  a,
double  b 
)
inlinestatic

Definition at line 751 of file NumericValue.h.

752  {
753  if (std::isinf(a) && std::isinf(b))
754  return a == b;
755  return std::fabs(a - b) < epsilon;
756  }
#define epsilon
Definition: NumericValue.h:41
cJSON * a
Definition: cJSON.cpp:2560
#define isinf(d)
Definition: cJSON.cpp:74
const cJSON *const b
Definition: cJSON.h:255

◆ equal()

bool SVF::BoundedDouble::equal ( const BoundedDouble rhs) const
inline

Definition at line 808 of file NumericValue.h.

809  {
810  return doubleEqual(_fVal, rhs._fVal);
811  }
static bool doubleEqual(double a, double b)
Definition: NumericValue.h:751

◆ geq()

bool SVF::BoundedDouble::geq ( const BoundedDouble rhs) const
inline

Definition at line 837 of file NumericValue.h.

838  {
839  if (is_infinity() ^ rhs.is_infinity())
840  {
841  if (is_infinity())
842  {
843  return is_plus_infinity();
844  }
845  else
846  {
847  return rhs.is_minus_infinity();
848  }
849  }
850  if (is_infinity() && rhs.is_infinity())
851  {
852  if (is_plus_infinity())
853  return true;
854  else
855  return rhs.is_minus_infinity();
856  }
857  else
858  return _fVal >= rhs._fVal;
859  }
bool is_plus_infinity() const
Definition: NumericValue.h:763
bool is_infinity() const
Definition: NumericValue.h:773

◆ getFVal()

const double SVF::BoundedDouble::getFVal ( ) const
inline

Definition at line 758 of file NumericValue.h.

759  {
760  return _fVal;
761  }

◆ getIntNumeral()

s64_t SVF::BoundedDouble::getIntNumeral ( ) const
inline

Definition at line 1272 of file NumericValue.h.

1273  {
1274  return getNumeral();
1275  }
s64_t getNumeral() const
Return Numeral.

◆ getNumeral()

s64_t SVF::BoundedDouble::getNumeral ( ) const
inline

Return Numeral.

Definition at line 1256 of file NumericValue.h.

1257  {
1258  if (is_minus_infinity())
1259  {
1260  return INT64_MIN;
1261  }
1262  else if (is_plus_infinity())
1263  {
1264  return INT64_MAX;
1265  }
1266  else
1267  {
1268  return std::round(_fVal);
1269  }
1270  }
bool is_minus_infinity() const
Definition: NumericValue.h:768

◆ getRealNumeral()

double SVF::BoundedDouble::getRealNumeral ( ) const
inline

Definition at line 1277 of file NumericValue.h.

1278  {
1279  return _fVal;
1280  }

◆ is_infinity()

bool SVF::BoundedDouble::is_infinity ( ) const
inline

Definition at line 773 of file NumericValue.h.

774  {
775  return is_plus_infinity() || is_minus_infinity();
776  }

◆ is_int()

bool SVF::BoundedDouble::is_int ( ) const
inline

Definition at line 1112 of file NumericValue.h.

1113  {
1114  return _fVal == std::round(_fVal);
1115  }

◆ is_minus_infinity()

bool SVF::BoundedDouble::is_minus_infinity ( ) const
inline

Definition at line 768 of file NumericValue.h.

769  {
770  return _fVal == -std::numeric_limits<double>::infinity();
771  }

◆ is_plus_infinity()

bool SVF::BoundedDouble::is_plus_infinity ( ) const
inline

Definition at line 763 of file NumericValue.h.

764  {
765  return _fVal == std::numeric_limits<double>::infinity();
766  }

◆ is_real()

bool SVF::BoundedDouble::is_real ( ) const
inline

Definition at line 1116 of file NumericValue.h.

1117  {
1118  return !is_int();
1119  }
bool is_int() const

◆ is_true()

bool SVF::BoundedDouble::is_true ( ) const
inline

Definition at line 1250 of file NumericValue.h.

1251  {
1252  return _fVal != 0.0f;
1253  }

◆ is_zero()

bool SVF::BoundedDouble::is_zero ( ) const
inline

Definition at line 798 of file NumericValue.h.

799  {
800  return doubleEqual(_fVal, 0.0f);
801  }

◆ isZero()

static bool SVF::BoundedDouble::isZero ( const BoundedDouble expr)
inlinestatic

Definition at line 803 of file NumericValue.h.

804  {
805  return doubleEqual(expr.getFVal(), 0.0f);
806  }

◆ leq()

bool SVF::BoundedDouble::leq ( const BoundedDouble rhs) const
inline

Definition at line 813 of file NumericValue.h.

814  {
815  if (is_infinity() ^ rhs.is_infinity())
816  {
817  if (is_infinity())
818  {
819  return is_minus_infinity();
820  }
821  else
822  {
823  return rhs.is_plus_infinity();
824  }
825  }
826  if (is_infinity() && rhs.is_infinity())
827  {
828  if (is_minus_infinity())
829  return true;
830  else
831  return rhs.is_plus_infinity();
832  }
833  else
834  return _fVal <= rhs._fVal;
835  }

◆ max()

static BoundedDouble SVF::BoundedDouble::max ( std::vector< BoundedDouble > &  _l)
inlinestatic

Definition at line 1230 of file NumericValue.h.

1231  {
1233  for (const auto& it : _l)
1234  {
1235  if (it.is_plus_infinity())
1236  return plus_infinity();
1237  else if (!it.leq(ret))
1238  {
1239  ret = it;
1240  }
1241  }
1242  return ret;
1243  }
BoundedDouble()=default
static BoundedDouble minus_infinity()
Definition: NumericValue.h:793
static BoundedDouble plus_infinity()
Definition: NumericValue.h:788

◆ min()

static BoundedDouble SVF::BoundedDouble::min ( std::vector< BoundedDouble > &  _l)
inlinestatic

Definition at line 1215 of file NumericValue.h.

1216  {
1218  for (const auto& it : _l)
1219  {
1220  if (it.is_minus_infinity())
1221  return minus_infinity();
1222  else if (!it.geq(ret))
1223  {
1224  ret = it;
1225  }
1226  }
1227  return ret;
1228  }

◆ minus_infinity()

static BoundedDouble SVF::BoundedDouble::minus_infinity ( )
inlinestatic

Definition at line 793 of file NumericValue.h.

794  {
795  return -std::numeric_limits<double>::infinity();
796  }

◆ operator=() [1/2]

BoundedDouble& SVF::BoundedDouble::operator= ( BoundedDouble &&  rhs)
inline

Definition at line 743 of file NumericValue.h.

744  {
745  _fVal = std::move(rhs._fVal);
746  return *this;
747  }

◆ operator=() [2/2]

BoundedDouble& SVF::BoundedDouble::operator= ( const BoundedDouble rhs)
inline

Definition at line 735 of file NumericValue.h.

736  {
737  _fVal = rhs._fVal;
738  return *this;
739  }

◆ plus_infinity()

static BoundedDouble SVF::BoundedDouble::plus_infinity ( )
inlinestatic

Definition at line 788 of file NumericValue.h.

789  {
790  return std::numeric_limits<double>::infinity();
791  }

◆ safeAdd()

static double SVF::BoundedDouble::safeAdd ( double  lhs,
double  rhs 
)
inlinestatic

Adds two floating-point numbers safely, checking for overflow and underflow conditions.

Parameters
lhsLeft-hand side operand of the addition.
rhsRight-hand side operand of the addition.
Returns
The sum of lhs and rhs. If overflow or underflow occurs, returns positive or negative infinity.

Definition at line 908 of file NumericValue.h.

909  {
910  if ((lhs == std::numeric_limits<double>::infinity() &&
911  rhs == -std::numeric_limits<double>::infinity()) ||
912  (lhs == -std::numeric_limits<double>::infinity() &&
913  rhs == std::numeric_limits<double>::infinity()))
914  {
915  assert(false && "invalid add");
916  }
917  double res =
918  lhs + rhs; // Perform the addition and store the result in 'res'
919 
920  // Check if the result is positive infinity due to overflow
921  if (res == std::numeric_limits<double>::infinity())
922  {
923  return res; // Positive overflow has occurred, return positive
924  // infinity
925  }
926 
927  // Check if the result is negative infinity, which can indicate a large
928  // negative overflow
929  if (res == -std::numeric_limits<double>::infinity())
930  {
931  return res; // Negative "overflow", effectively an underflow to
932  // negative infinity
933  }
934 
935  // Check for positive overflow: verify if both operands are positive and
936  // their sum exceeds the maximum double value
937  if (lhs > 0 && rhs > 0 &&
938  (std::numeric_limits<double>::max() - lhs) < rhs)
939  {
940  res = std::numeric_limits<double>::infinity(); // Set result to
941  // positive infinity to
942  // indicate overflow
943  return res;
944  }
945 
946  // Check for an underflow scenario: both numbers are negative and their
947  // sum is more negative than what double can represent
948  if (lhs < 0 && rhs < 0 &&
949  (-std::numeric_limits<double>::max() - lhs) > rhs)
950  {
951  res = -std::numeric_limits<
952  double>::infinity(); // Set result to negative infinity to
953  // clarify extreme negative sum
954  return res;
955  }
956 
957  // If none of the above conditions are met, return the result of the
958  // addition
959  return res;
960  }

◆ safeDiv()

static double SVF::BoundedDouble::safeDiv ( double  lhs,
double  rhs 
)
inlinestatic

Safely divides one floating-point number by another, checking for division by zero and overflow.

Parameters
lhsLeft-hand side operand (numerator).
rhsRight-hand side operand (denominator).
Returns
The quotient of lhs and rhs. Returns positive or negative infinity for division by zero, or when overflow occurs.

Definition at line 1049 of file NumericValue.h.

1050  {
1051  // Check for division by zero
1052  if (doubleEqual(rhs, 0.0f))
1053  {
1054  return (lhs >= 0.0f) ? std::numeric_limits<double>::infinity()
1055  : -std::numeric_limits<double>::infinity();
1056  }
1057  double res = lhs / rhs;
1058  // Check if the result is positive infinity due to overflow
1059  if (res == std::numeric_limits<double>::infinity())
1060  {
1061  return res; // Positive overflow has occurred, return positive
1062  // infinity
1063  }
1064 
1065  // Check if the result is negative infinity, which can indicate a large
1066  // negative overflow
1067  if (res == -std::numeric_limits<double>::infinity())
1068  {
1069  return res; // Negative "overflow", effectively an underflow to
1070  // negative infinity
1071  }
1072 
1073  // Check for overflow when dividing small numbers
1074  if (rhs > 0 && rhs < std::numeric_limits<double>::min() &&
1075  lhs > std::numeric_limits<double>::max() * rhs)
1076  {
1077  return std::numeric_limits<double>::infinity();
1078  }
1079  if (rhs < 0 && rhs > -std::numeric_limits<double>::min() &&
1080  lhs > std::numeric_limits<double>::max() * rhs)
1081  {
1082  return -std::numeric_limits<double>::infinity();
1083  }
1084 
1085  return res; // If no special cases, return the quotient
1086  }

◆ safeMul()

static double SVF::BoundedDouble::safeMul ( double  lhs,
double  rhs 
)
inlinestatic

Safely multiplies two floating-point numbers, checking for overflow and underflow.

Parameters
lhsLeft-hand side operand of the multiplication.
rhsRight-hand side operand of the multiplication.
Returns
The product of lhs and rhs. If overflow or underflow occurs, returns positive or negative infinity accordingly.

Definition at line 988 of file NumericValue.h.

989  {
990  if (doubleEqual(lhs, 0.0f) || doubleEqual(rhs, 0.0f))
991  return 0.0f;
992  double res = lhs * rhs;
993  // Check if the result is positive infinity due to overflow
994  if (res == std::numeric_limits<double>::infinity())
995  {
996  return res; // Positive overflow has occurred, return positive
997  // infinity
998  }
999 
1000  // Check if the result is negative infinity, which can indicate a large
1001  // negative overflow
1002  if (res == -std::numeric_limits<double>::infinity())
1003  {
1004  return res; // Negative "overflow", effectively an underflow to
1005  // negative infinity
1006  }
1007  // Check for overflow scenarios
1008  if (lhs > 0 && rhs > 0 &&
1009  lhs > std::numeric_limits<double>::max() / rhs)
1010  {
1011  return std::numeric_limits<double>::infinity();
1012  }
1013  if (lhs < 0 && rhs < 0 &&
1014  lhs < std::numeric_limits<double>::max() / rhs)
1015  {
1016  return std::numeric_limits<double>::infinity();
1017  }
1018 
1019  // Check for "underflow" scenarios (negative overflow)
1020  if (lhs > 0 && rhs < 0 &&
1021  rhs < std::numeric_limits<double>::lowest() / lhs)
1022  {
1023  return -std::numeric_limits<double>::infinity();
1024  }
1025  if (lhs < 0 && rhs > 0 &&
1026  lhs < std::numeric_limits<double>::lowest() / rhs)
1027  {
1028  return -std::numeric_limits<double>::infinity();
1029  }
1030 
1031  return res; // If no overflow or underflow, return the product
1032  }

◆ set_minus_infinity()

void SVF::BoundedDouble::set_minus_infinity ( )
inline

Definition at line 783 of file NumericValue.h.

784  {
785  *this = minus_infinity();
786  }

◆ set_plus_infinity()

void SVF::BoundedDouble::set_plus_infinity ( )
inline

Definition at line 778 of file NumericValue.h.

779  {
780  *this = plus_infinity();
781  }

◆ to_string()

virtual const std::string SVF::BoundedDouble::to_string ( ) const
inlinevirtual

Definition at line 1282 of file NumericValue.h.

1283  {
1284  return std::to_string(_fVal);
1285  }

Friends And Related Function Documentation

◆ abs

BoundedDouble abs ( const BoundedDouble lhs)
friend

Definition at line 1245 of file NumericValue.h.

1246  {
1247  return lhs.leq(0) ? -lhs : lhs;
1248  }

◆ eq

bool eq ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 1200 of file NumericValue.h.

1201  {
1202  return doubleEqual(lhs._fVal, rhs._fVal);
1203  }

◆ ite

BoundedDouble ite ( const BoundedDouble cond,
const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 1187 of file NumericValue.h.

1189  {
1190  return cond._fVal != 0.0f ? lhs._fVal : rhs._fVal;
1191  }

◆ max

BoundedDouble max ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 1210 of file NumericValue.h.

1211  {
1212  return std::max(lhs._fVal, rhs._fVal);
1213  }

◆ min

BoundedDouble min ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 1205 of file NumericValue.h.

1206  {
1207  return std::min(lhs._fVal, rhs._fVal);
1208  }

◆ operator!

BoundedDouble operator! ( const BoundedDouble lhs)
friend

Definition at line 1154 of file NumericValue.h.

1155  {
1156  return !lhs._fVal;
1157  }

◆ operator!=

BoundedDouble operator!= ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 869 of file NumericValue.h.

871  {
872  return !lhs.equal(rhs);
873  }

◆ operator%

BoundedDouble operator% ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 1094 of file NumericValue.h.

1096  {
1097  if (rhs.is_zero())
1098  assert(false && "divide by zero");
1099  else if (!lhs.is_infinity() && !rhs.is_infinity())
1100  return std::fmod(lhs._fVal, rhs._fVal);
1101  else if (!lhs.is_infinity() && rhs.is_infinity())
1102  return 0.0f;
1103  // TODO: not sure
1104  else if (lhs.is_infinity() && !rhs.is_infinity())
1105  return ite(rhs._fVal > 0.0f, lhs, -lhs);
1106  else
1107  // TODO: +oo/-oo L'Hôpital's rule?
1108  return eq(lhs, rhs) ? plus_infinity() : minus_infinity();
1109  abort();
1110  }
friend BoundedDouble ite(const BoundedDouble &cond, const BoundedDouble &lhs, const BoundedDouble &rhs)
friend bool eq(const BoundedDouble &lhs, const BoundedDouble &rhs)

◆ operator&

BoundedDouble operator& ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 1128 of file NumericValue.h.

1130  {
1131  int lInt = std::round(lhs._fVal), rInt = std::round(rhs._fVal);
1132  return lInt & rInt;
1133  }

◆ operator&&

BoundedDouble operator&& ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 1142 of file NumericValue.h.

1144  {
1145  return lhs._fVal && rhs._fVal;
1146  }

◆ operator*

BoundedDouble operator* ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 1034 of file NumericValue.h.

1036  {
1037  return safeMul(lhs._fVal, rhs._fVal);
1038  }
static double safeMul(double lhs, double rhs)
Definition: NumericValue.h:988

◆ operator+

BoundedDouble operator+ ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 962 of file NumericValue.h.

964  {
965  return safeAdd(lhs._fVal, rhs._fVal);
966  }
static double safeAdd(double lhs, double rhs)
Definition: NumericValue.h:908

◆ operator- [1/2]

BoundedDouble operator- ( const BoundedDouble lhs)
friend

Definition at line 968 of file NumericValue.h.

969  {
970  return -lhs._fVal;
971  }

◆ operator- [2/2]

BoundedDouble operator- ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 973 of file NumericValue.h.

975  {
976  return safeAdd(lhs._fVal, -rhs._fVal);
977  }

◆ operator/

BoundedDouble operator/ ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 1088 of file NumericValue.h.

1090  {
1091  return safeDiv(lhs._fVal, rhs._fVal);
1092  }
static double safeDiv(double lhs, double rhs)

◆ operator<

BoundedDouble operator< ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 881 of file NumericValue.h.

883  {
884  return !lhs.geq(rhs);
885  }

◆ operator<< [1/2]

BoundedDouble operator<< ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 1173 of file NumericValue.h.

1175  {
1176  assert(rhs.geq(0) && "rhs should be greater or equal than 0");
1177  if (lhs.is_zero())
1178  return lhs;
1179  else if (lhs.is_infinity())
1180  return lhs;
1181  else if (rhs.is_infinity())
1182  return lhs.geq(0) ? plus_infinity() : minus_infinity();
1183  else
1184  return (s32_t)lhs.getNumeral() << (s32_t)rhs.getNumeral();
1185  }
signed s32_t
Definition: GeneralType.h:47

◆ operator<< [2/2]

std::ostream& operator<< ( std::ostream &  out,
const BoundedDouble expr 
)
friend

Definition at line 1193 of file NumericValue.h.

1195  {
1196  out << expr._fVal;
1197  return out;
1198  }

◆ operator<=

BoundedDouble operator<= ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 887 of file NumericValue.h.

889  {
890  return lhs.leq(rhs);
891  }

◆ operator==

BoundedDouble operator== ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Reload operator.

Definition at line 863 of file NumericValue.h.

865  {
866  return lhs.equal(rhs);
867  }

◆ operator>

BoundedDouble operator> ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 875 of file NumericValue.h.

877  {
878  return !lhs.leq(rhs);
879  }

◆ operator>=

BoundedDouble operator>= ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 893 of file NumericValue.h.

895  {
896  return lhs.geq(rhs);
897  }

◆ operator>>

BoundedDouble operator>> ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 1159 of file NumericValue.h.

1161  {
1162  assert(rhs.geq(0) && "rhs should be greater or equal than 0");
1163  if (lhs.is_zero())
1164  return lhs;
1165  else if (lhs.is_infinity())
1166  return lhs;
1167  else if (rhs.is_infinity())
1168  return lhs.geq(0) ? 0 : -1;
1169  else
1170  return (s32_t)lhs.getNumeral() >> (s32_t)rhs.getNumeral();
1171  }

◆ operator^

BoundedDouble operator^ ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 1121 of file NumericValue.h.

1123  {
1124  int lInt = std::round(lhs._fVal), rInt = std::round(rhs._fVal);
1125  return lInt ^ rInt;
1126  }

◆ operator|

BoundedDouble operator| ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 1135 of file NumericValue.h.

1137  {
1138  int lInt = std::round(lhs._fVal), rInt = std::round(rhs._fVal);
1139  return lInt | rInt;
1140  }

◆ operator||

BoundedDouble operator|| ( const BoundedDouble lhs,
const BoundedDouble rhs 
)
friend

Definition at line 1148 of file NumericValue.h.

1150  {
1151  return lhs._fVal || rhs._fVal;
1152  }

Member Data Documentation

◆ _fVal

double SVF::BoundedDouble::_fVal
protected

Definition at line 726 of file NumericValue.h.


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