Library: Foundation
Package: Core
Header: Poco/FPEnvironment.h
Instances of this class can be used to save and later restore the current floating point environment (consisting of rounding mode and floating-point flags). The class also provides various static methods to query certain properties of a floating-point number.
Direct Base Classes: FPEnvironmentImpl
All Base Classes: FPEnvironmentImpl
Member Functions: clearFlags, copySign, getRoundingMode, isFlag, isInfinite, isNaN, keepCurrent, operator =, setRoundingMode
FP_DIVIDE_BY_ZERO = FP_DIVIDE_BY_ZERO_IMPL
FP_INEXACT = FP_INEXACT_IMPL
FP_OVERFLOW = FP_OVERFLOW_IMPL
FP_UNDERFLOW = FP_UNDERFLOW_IMPL
FP_INVALID = FP_INVALID_IMPL
FP_ROUND_DOWNWARD = FP_ROUND_DOWNWARD_IMPL
FP_ROUND_UPWARD = FP_ROUND_UPWARD_IMPL
FP_ROUND_TONEAREST = FP_ROUND_TONEAREST_IMPL
FP_ROUND_TOWARDZERO = FP_ROUND_TOWARDZERO_IMPL
Standard constructor. Remembers the current environment.
FPEnvironment(
RoundingMode mode
);
Remembers the current environment and sets the given rounding mode.
FPEnvironment(
const FPEnvironment & env
);
Copy constructor.
~FPEnvironment();
Restores the previous environment (unless keepCurrent() has been called previously)
static void clearFlags();
Resets all flags.
static float copySign(
float target,
float source
);
static double copySign(
double target,
double source
);
static long double copySign(
long double target,
long double source
);
Copies the sign from source to target.
static RoundingMode getRoundingMode();
Returns the current rounding mode.
static bool isFlag(
Flag flag
);
Returns true if and only if the given flag is set.
static bool isInfinite(
float value
);
static bool isInfinite(
double value
);
static bool isInfinite(
long double value
);
Returns true if and only if the given number is infinite.
static bool isNaN(
float value
);
static bool isNaN(
double value
);
static bool isNaN(
long double value
);
Returns true if and only if the given number is NaN.
void keepCurrent();
Keep the current environment even after destroying the FPEnvironment object.
FPEnvironment & operator = (
const FPEnvironment & env
);
Assignment operator
static void setRoundingMode(
RoundingMode mode
);
Sets the rounding mode.