aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/Foundation/src/FPEnvironment_QNX.cpp
blob: 057eb8eb7bcd271a29d9f9bd5a4c5e62aeee6634 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//
// FPEnvironment_QNX.cpp
//
// Library: Foundation
// Package: Core
// Module:  FPEnvironment
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier:	BSL-1.0
//


#include "Poco/FPEnvironment_QNX.h"


namespace Poco {


FPEnvironmentImpl::FPEnvironmentImpl()
{
	fegetenv(&_env);
}


FPEnvironmentImpl::FPEnvironmentImpl(const FPEnvironmentImpl& env)
{
	_env = env._env;
}


FPEnvironmentImpl::~FPEnvironmentImpl()
{
	fesetenv(&_env);
}


FPEnvironmentImpl& FPEnvironmentImpl::operator = (const FPEnvironmentImpl& env)
{
	_env = env._env;
	return *this;
}


void FPEnvironmentImpl::keepCurrentImpl()
{
	fegetenv(&_env);
}


void FPEnvironmentImpl::clearFlagsImpl()
{
	feclearexcept(FE_ALL_EXCEPT);
}


bool FPEnvironmentImpl::isFlagImpl(FlagImpl flag)
{
	return fetestexcept(flag) != 0;
}


void FPEnvironmentImpl::setRoundingModeImpl(RoundingModeImpl mode)
{
	fesetround(mode);
}


FPEnvironmentImpl::RoundingModeImpl FPEnvironmentImpl::getRoundingModeImpl()
{
	return (RoundingModeImpl) fegetround();
}


long double FPEnvironmentImpl::copySignImpl(long double target, long double source)
{
	return (source >= 0 && target >= 0) || (source < 0 && target < 0) ? target : -target;
}


} // namespace Poco