Solved

double to hexadecimal

Posted on 2009-05-15
9
447 Views
Last Modified: 2012-05-07
Hi,

I want to know C functions which perform "double to Hexadecimal" and "Hexadecimal to double"
Can you please help me how to write code of above?

Thanks...
0
Comment
Question by:palhade
9 Comments
 
LVL 39

Accepted Solution

by:
abel earned 500 total points
ID: 24394594
0
 
LVL 40

Expert Comment

by:evilrix
ID: 24394904
>> I want to know C functions which perform "double to Hexadecimal" and "Hexadecimal to double"
Double is a c/c++ type whereas hexadecimal is a number base (base 16). Therefore, can you please clarify what you mean by this since the question doesn't contain enough information to provide an answer. Are you saying you want to convert a double to a string representation in hexadecimal?
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 24394946
IN C99, you can use the %a or %A format with the printf family to print a floating point value in hexadecimal.

The standard strtod function also supports hexadecimal floating point values (in C99).
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:palhade
ID: 24395390
convert a double to a string representation in hexadecimal?
I am using VC++ Express edition
0
 
LVL 39

Expert Comment

by:abel
ID: 24396265
inside memory, the double takes 8 bytes. You can place them into hexadecimal, which is what I showed you. If that is not what you want, can you give an example of what goes into your function and what you expect it to go out?

btw: have you tried my suggestion and if so, what are your results and/or follow-up questions?
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 24396333
>> convert a double to a string representation in hexadecimal?

See my earlier post. For C99, you can use the %a or %A format with sprintf. Otherwise, you can use a custom solution ...
0
 
LVL 39

Expert Comment

by:abel
ID: 24569950
Thanks for grading me, but you got many answers and follow-ups. Lower-grading is something you should use for those cases where you haven't received a complete answer, tried to get more info, but didn't get it. You have not clarified your requirements, got many suggestions but did not follow-up. Sorry, but that's not the way things work over here. Consider splitting points and the 10pts must principle in the EE FAQ.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Passing command line arguments in C 10 85
thread-safe code in c++ 2 86
c++ reading data from file into two dimensional array 3 96
Computer slow / BSOD 10 44
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now