Update contrib.
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\euser\maths\um_spec.cpp
15 // Functions to check for and set special values
25 #ifndef __REALS_MACHINE_CODED__
26 EXPORT_C TBool Math::IsZero(const TReal &aVal)
28 Determines whether a value is zero.
30 @param aVal A reference to the value to be checked.
32 @return True, if aVal is zero; false, otherwise.
36 SReal64 *pS=(SReal64 *)&aVal;
38 if (pS->msm==0 && pS->lsm==0 && pS->exp==KTReal64ZeroExponent)
47 EXPORT_C TBool Math::IsNaN(const TReal &aVal)
49 Determines whether a value is not a number.
51 @param aVal A reference to the value to be checked.
53 @return True, if aVal is not a number; false, otherwise.
57 SReal64 *pS=(SReal64 *)&aVal;
59 if (pS->exp==KTReal64SpecialExponent && (pS->msm|pS->lsm)!=0)
68 EXPORT_C TBool Math::IsInfinite(const TReal &aVal)
70 Determines whether a value is infinite.
72 @param aVal A reference to the value to be checked.
74 @return True, if aVal is infinite; false, otherwise.
78 SReal64 *pS=(SReal64 *)&aVal;
80 if (pS->msm==0 && pS->lsm==0 && pS->exp==KTReal64SpecialExponent)
89 EXPORT_C TBool Math::IsFinite(const TReal &aVal)
91 Determines whether a value is finite.
93 In this context, a value is finite if it is a valid number and
96 @param aVal A reference to the value to be checked.
98 @return True, if aVal is finite; false, otherwise.
102 SReal64 *pS=(SReal64 *)&aVal;
104 if (pS->exp!=KTReal64SpecialExponent)
113 EXPORT_C void Math::SetZero(TReal &aVal,TInt aSign)
115 // Constructs zeros, assuming default sign is positive
119 SReal64 *pS=(SReal64 *)&aVal;
121 pS->exp=KTReal64ZeroExponent;
129 EXPORT_C void Math::SetNaN(TReal &aVal)
131 // Constructs NaN (+ve sign for Java)
135 SReal64 *pS=(SReal64 *)&aVal;
137 pS->exp=KTReal64SpecialExponent;
145 EXPORT_C void Math::SetInfinite(TReal &aVal,TInt aSign)
147 // Constructs infinities
151 SReal64 *pS=(SReal64 *)&aVal;
153 pS->exp=KTReal64SpecialExponent;