Update contrib.
1 // Copyright (c) 1995-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_utl.cpp
20 #if defined(__USE_VFP_MATH) && !defined(__CPU_HAS_VFP)
21 #error __USE_VFP_MATH was defined but not __CPU_HAS_VFP - impossible combination, check variant.mmh
24 GLDEF_C void Panic(TMathPanic aPanic)
26 // Panic the process with USER-Math as the category.
30 User::Panic(_L("USER-Math"),aPanic);
36 extern "C" void __set_errno(TInt errno)
38 // Do nothing, we don't have an errno to set as we use
39 // return values instead - return values are recosntructed
40 // from the results/inputs, not from this
43 extern "C" IMPORT_C TReal __ARM_scalbn(TReal,TInt);
44 extern "C" TReal scalbn(TReal x,TInt n)
46 return __ARM_scalbn(x,n);
52 #ifndef __REALS_MACHINE_CODED__
53 EXPORT_C TReal Math::Poly(TReal aX,const SPoly *aPoly)
55 Evaluates the polynomial:
56 {a[n]X^n + a[n-1]X^(n-1) + ... + a[2]X^2 + a[1]X^1 + a[0]}.
59 @param aX The value of the x-variable
60 @param aPoly A pointer to the structure containing the set of coefficients
61 in the order: a[0], a[1], ..., a[n-1], a[n].
63 @return The result of the evaluation.
66 // Evaluate a power series in x for a P_POLY coefficient table.
67 // Changed to use TRealX throughout the calculation
71 const TReal *pR=(&aPoly->c[aPoly->num-1]);
74 while (pR>&aPoly->c[0])
85 EXPORT_C void Math::PolyX(TRealX& aY, const TRealX& aX, TInt aDegree, const TRealX *aCoeff)
87 Evaluates the polynomial:
88 {a[n]X^n + a[n-1]X^(n-1) + ... + a[2]X^2 + a[1]X^1 + a[0]}.
90 @param aY A reference containing the result.
91 @param aX The value of the x-variable.
92 @param aDegree The degree of the polynomial (the highest power of x
94 @param aCoeff A pointer to a contiguous set of TRealX values containing
96 They must be in the order: a[0], a[1], ..., a[n-1], a[n].
99 // Evaluate a polynomial with TRealX argument and TRealX coefficients.
100 // Return a TRealX result.
102 const TRealX *pC=aCoeff+aDegree;