|
Hi,
The value stored in Float and same value when stored in double there is difference in the value Why?
Eg:
void main()
{
CString str;
union
{
float f1;
unsigned long a1;
}un1;
union
{
double d_f1;
unsigned long d_a1;
}d_un1;
float flt;
double d_flt;
un1.a1 = 0;
un1.f1 = 0.0;
un1.a1=0x6fffffff;
flt = un1.f1;
d_un1.d_a1 = 0;
d_un1.d_f1 = 0.0;
d_un1.d_a1=0x6fffffff;
d_flt = d_un1.d_f1;
}
Output:
d_flt 9.2837315805324e-315
flt 1.58456e+029
d_un1.d_f1 9.2837315805324e-315
un1.f1 1.58456e+029
I need the variable to hold value upto 0xffffffff as float cannot hold it i used double but there is a variation in the value if value is <7fffffffff.Is due to IEEE internal representation.HOw to resolve this.
Thanks
|
|
|
|
|
shir_k wrote: I need the variable to hold value upto 0xffffffff as float
Why? I mean: cannot you use the unsigned integer instead?
shir_k wrote: Is due to IEEE internal representation.HOw to resolve this
The above is true and there's nothing to resolve.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Yes we can use unsigned integer but am more concerned about float value.
Is any function in VC++ to convert hex value (0xffffffff) to equivalent float value.
Thanks
|
|
|
|
|
shir_k wrote: Is any function in VC++ to convert hex value (0xffffffff) to equivalent float value.
You cannot have such a function since the float value of 0xffffffff, according to IEEE 754 standard belongs to the NaN (Not a Number) set.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
|
Hi, to all!
I have a problem on 'OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)' function where I try to set BkColor of my dialog!
HBRUSH CDialList::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
if( nCtlColor == CTLCOLOR_DLG )<br />
{<br />
SelectObject(pDC->m_hDC,GetStockObject(DC_BRUSH));<br />
SetDCBrushColor(pDC->m_hDC,RGB(230,251,251)); <br />
}<br />
...<br />
When I compile i get two errors:
"DC_BRUSH' : undeclared identifier", and
"'SetDCBrushColor' : undeclared identifier".
???
Thanks.
P.S.
I'm using VC++ 6
|
|
|
|
|
if( nCtlColor == CTLCOLOR_DLG )
{
return (HBRUSH)GetStockObject( BLACK_BRUSH );
}
or
if( nCtlColor == CTLCOLOR_DLG )
{
return (HBRUSH)m_brush.GetSafeHandle();
}
- NS -
|
|
|
|
|
Thanks for replay!
I want to set different color, not black!
|
|
|
|
|
Call m_brush.CreateSolidBrush( RGB( ... )) in OnInitDialog.
- NS -
|
|
|
|
|
Not 100% sure as it's 2 years since I wrote GDI wrappers but I think SetDCBrushColor is that wierd API that is documented everywhere but doesn't exist/work anywhere, at least pre-Vista. I'm sure Google will confirm or deny this pretty quickly, it's worth a check. If memory serves there is an alternative possibly Ex variant which works at least in XP.
DC_BRUSH is defined in WinGDI.h iff _WIN32_WINNT >= 0x0500 so you need to be building for Windows 2000 or later to use it and linking to gdi32.lib of course.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Will this help????
<br />
CBrush brush;<br />
brush.CreateSolidBrush(RGB(230,251,251));<br />
<br />
CBrush* pOldBrush1 =pDC->SelectObject(&brush);<br />
<br />
pDC->SelectObject(pOldBrush);<br />
Priya Sundar
|
|
|
|
|
Hi,
I want to check if a table exists in sqlite,sql server 2005,mysql and in sqlexpress databases. if the table doesnt exist i have to create table in all these databases.i tried create table[if not exists] command but it is working in sqlite but not in sql 2005.
can anybody plz help me out...
kk
|
|
|
|
|
santhi_malli wrote: if the table doesnt exist i have to create table in all these databases.i tried create table[if not exists] command but it is working in sqlite but not in sql 2005.
whta is the code! have track the error, which is throwed!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I want to write c++ program that converts distance entered in metre (input) to be converted to feet and inches and vice versa the program should use classes. Anyone to help me out???pliz
tick tock tick tock programming tick tocks...
|
|
|
|
|
what have you tried so far, and where are you stuck with the code ?
this looks like a homework, and if you don't try by yourself, how will you learn things ?
|
|
|
|
|
concomarx wrote: I want to write c++ program that converts distance entered in metre (input) to be converted to feet and inches and vice versa the program should use classes
The big deal, my dear, is to fit all the above calculations in few classes...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I've tried it gives me funny errors, hows that got another way maybe am doing it badly
tick tock tick tock programming tick tocks...
|
|
|
|
|
Try to post your code..
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
concomarx wrote: I've tried it gives me funny errors...
Errors aren't funny, they are serious.
concomarx wrote: ...maybe am doing it badly
How could we possibly know if you don't show us what you've tried?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
1 meter = 39,370079 inch = 3,28084 foot
1 inch = 0,083333 foot = 0,0254 meter
1 foot = 0,3048 meter = 12 inches
Hope it helps
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
concomarx wrote: tick tock tick tock programming tick tocks...
MATLAB-Programmer?
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
jhwurmbach wrote: MATLAB-Programmer?
humm c++ programmer
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
tick and tock are the timing functions in MATLAB-script.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
tick and tock are the timing functions in MATLAB-script.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Here is the declaration statement.
unsigned char *String;
Now i have made String point to "{abcdef}".
Here i need to delete the paranthesis, i.e, i need to delete the first and last character in 'String'.
How to make it point to a val of just "abcdef" without the first and last character??
Kindly help!
Priya Sundar
|
|
|
|