DECIMAL to double convertsion

C

Chetan Raj

Hi All,

I want to convert a DECIMAL type to double type. Is there any API or
standard function for it? Is there any recommended way to convert it.

Currently I am using the following code to convert.

double nDoubleData;
CComBSTR bstrTemp;
VarBstrFromDec(&(varData.decVal),0x0409,LOCALE_NOUSEROVERRIDE,&(bstrTemp.m_str));
VarR8FromStr((LPWSTR)bstrTemp,0x0409,LOCALE_NOUSEROVERRIDE,&nDoubleData);

//varData.decVal has the DECIMAL value, from which a double type is
extracted into nDoubleData


But, I know that the code is inefficient.

Is there any better way to do it?

Thanking in advance for any help.
Chetan Raj
 
J

JKop

Chetan Raj posted:
Hi All,

I want to convert a DECIMAL type to double type. Is there any API or
standard function for it? Is there any recommended way to convert it.

Currently I am using the following code to convert.

double nDoubleData;
CComBSTR bstrTemp;
VarBstrFromDec(& (varData.decVal),0x0409,LOCALE_NOUSEROVERRIDE,&(bstrTemp
bstrTemp,0x0409,LOCALE_NOUSEROVERRIDE,&nDoubleData)
;

//varData.decVal has the DECIMAL value, from which a double type is
extracted into nDoubleData


But, I know that the code is inefficient.

Is there any better way to do it?

Thanking in advance for any help.
Chetan Raj

Gives us the definition of the DECIMAl type and we might be
able to help you!


-JKop
 
V

Victor Bazarov

Chetan said:
I want to convert a DECIMAL type to double type. Is there any API or
standard function for it? Is there any recommended way to convert it.

C++ has no concept of "DECIMAL type", so, no, there is no standard
function for it.

Victor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top