Click here to Skip to main content
15,916,702 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionExit when press "Enter" ? Pin
Surivevoli18-Apr-06 9:06
Surivevoli18-Apr-06 9:06 
AnswerRe: Exit when press "Enter" ? Pin
Rage18-Apr-06 9:11
professionalRage18-Apr-06 9:11 
AnswerRe: Exit when press "Enter" ? Pin
Hamid_RT18-Apr-06 18:50
Hamid_RT18-Apr-06 18:50 
QuestionBinary inputs Pin
CPP91118-Apr-06 9:00
CPP91118-Apr-06 9:00 
AnswerRe: Binary inputs Pin
Rage18-Apr-06 9:09
professionalRage18-Apr-06 9:09 
AnswerRe: Binary inputs Pin
David Crow18-Apr-06 9:37
David Crow18-Apr-06 9:37 
AnswerRe: Binary inputs Pin
Stephen Hewitt18-Apr-06 15:34
Stephen Hewitt18-Apr-06 15:34 
QuestionConverting numbers Pin
Waldermort18-Apr-06 8:49
Waldermort18-Apr-06 8:49 
Hi all,

I have found myself totaly confused yet again. I need to convert a 32bit int to a double. Well the docs say "an IEEE 754 floating-point value (64bit double precision). It then goes on to demonstarte the before and after (without any code).

0x3FF00000 -> (Decoded value) 0x3FF0000000000000 -> (Result) 1.0 'decimal'

I have managed to find some examples on the net, but unfortunatly none of them are in C/C++. Here is a C# method:
double ToDouble(int n){
    byte[] doubleBytes = new byte[8];
    byte[] uintBytes = BitConverter.GetBytes(n);
    Array.Copy(uintBytes, 0, doubleBytes, doubleBytes.Length - uintBytes.Length, uintBytes.Length);
    return BitConverter.ToDouble(doubleBytes, 0);
}
I hope somebody can help me with the answer, I am totaly stuck. Thankyou.
AnswerRe: Converting numbers Pin
Rage18-Apr-06 9:06
professionalRage18-Apr-06 9:06 
GeneralRe: Converting numbers Pin
Waldermort18-Apr-06 9:10
Waldermort18-Apr-06 9:10 
GeneralRe: Converting numbers Pin
Rage18-Apr-06 9:14
professionalRage18-Apr-06 9:14 
GeneralRe: Converting numbers Pin
Waldermort18-Apr-06 9:30
Waldermort18-Apr-06 9:30 
GeneralRe: Converting numbers Pin
John M. Drescher18-Apr-06 10:10
John M. Drescher18-Apr-06 10:10 
GeneralRe: Converting numbers Pin
Waldermort18-Apr-06 10:23
Waldermort18-Apr-06 10:23 
GeneralRe: Converting numbers Pin
John M. Drescher18-Apr-06 10:35
John M. Drescher18-Apr-06 10:35 
GeneralRe: Converting numbers Pin
Waldermort18-Apr-06 10:40
Waldermort18-Apr-06 10:40 
GeneralRe: Converting numbers Pin
John M. Drescher18-Apr-06 10:42
John M. Drescher18-Apr-06 10:42 
GeneralRe: Converting numbers Pin
Rage18-Apr-06 22:18
professionalRage18-Apr-06 22:18 
GeneralRe: Converting numbers Pin
Stephen Hewitt18-Apr-06 14:34
Stephen Hewitt18-Apr-06 14:34 
AnswerRe: Converting numbers Pin
John M. Drescher18-Apr-06 9:53
John M. Drescher18-Apr-06 9:53 
GeneralRe: Converting numbers Pin
Waldermort18-Apr-06 20:36
Waldermort18-Apr-06 20:36 
QuestionToolbar Pin
Rage18-Apr-06 8:47
professionalRage18-Apr-06 8:47 
AnswerRe: Toolbar Pin
Rage18-Apr-06 9:22
professionalRage18-Apr-06 9:22 
QuestionChecked menu ??? Pin
Surivevoli18-Apr-06 8:34
Surivevoli18-Apr-06 8:34 
AnswerRe: Checked menu ??? Pin
includeh1018-Apr-06 8:51
includeh1018-Apr-06 8:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.