class Poco::FPEnvironment

Overview

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). Moreā€¦

#include <FPEnvironment.h>

class FPEnvironment: private Poco::FPEnvironmentImpl
{
public:
    // enums

    enum Flag;
    enum RoundingMode;

    // construction

    FPEnvironment();
    FPEnvironment(RoundingMode mode);
    FPEnvironment(const FPEnvironment& env);

    // methods

    FPEnvironment&
    operator=(const FPEnvironment& env);

    void
    keepCurrent();

    static
    void
    clearFlags();

    static
    bool
    isFlag(Flag flag);

    static
    void
    setRoundingMode(RoundingMode mode);

    static
    RoundingMode
    getRoundingMode();

    static
    bool
    isInfinite(float value);

    static
    bool
    isInfinite(double value);

    static
    bool
    isInfinite(long double value);

    static
    bool
    isNaN(float value);

    static
    bool
    isNaN(double value);

    static
    bool
    isNaN(long double value);

    static
    float
    copySign(
        float target,
        float source
        );

    static
    double
    copySign(
        double target,
        double source
        );

    static
    long double
    copySign(
        long double target,
        long double source
        );
};

Inherited Members

protected:
    // enums

    enum FlagImpl;
    enum RoundingModeImpl;

    // methods

    FPEnvironmentImpl&
    operator=(const FPEnvironmentImpl& env);

    void
    keepCurrentImpl();

    static
    bool
    isInfiniteImpl(float value);

    static
    bool
    isInfiniteImpl(double value);

    static
    bool
    isInfiniteImpl(long double value);

    static
    bool
    isNaNImpl(float value);

    static
    bool
    isNaNImpl(double value);

    static
    bool
    isNaNImpl(long double value);

    static
    float
    copySignImpl(
        float target,
        float source
        );

    static
    double
    copySignImpl(
        double target,
        double source
        );

    static
    long double
    copySignImpl(
        long double target,
        long double source
        );

    static
    void
    clearFlagsImpl();

    static
    bool
    isFlagImpl(FlagImpl flag);

    static
    void
    setRoundingModeImpl(RoundingModeImpl mode);

    static
    RoundingModeImpl
    getRoundingModeImpl();

    static
    bool
    isInfiniteImpl(float value);

    static
    bool
    isInfiniteImpl(double value);

    static
    bool
    isInfiniteImpl(long double value);

    static
    bool
    isNaNImpl(float value);

    static
    bool
    isNaNImpl(double value);

    static
    bool
    isNaNImpl(long double value);

    static
    float
    copySignImpl(
        float target,
        float source
        );

    static
    double
    copySignImpl(
        double target,
        double source
        );

    static
    long double
    copySignImpl(
        long double target,
        long double source
        );

Detailed Documentation

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.

Construction

FPEnvironment()

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.

Methods

FPEnvironment&
operator=(const FPEnvironment& env)

Assignment operator.

void
keepCurrent()

Keep the current environment even after destroying the FPEnvironment object.

static
void
clearFlags()

Resets all flags.

static
bool
isFlag(Flag flag)

Returns true iff the given flag is set.

static
void
setRoundingMode(RoundingMode mode)

Sets the rounding mode.

static
RoundingMode
getRoundingMode()

Returns the current rounding mode.

static
bool
isInfinite(long double value)

Returns true iff the given number is infinite.

static
bool
isNaN(long double value)

Returns true iff the given number is NaN.

static
long double
copySign(
    long double target,
    long double source
    )

Copies the sign from source to target.