double to hexadecimal

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...
palhadeAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
abelConnect With a Mentor Commented:
0
 
evilrixSenior Software Engineer (Avast)Commented:
>> 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
 
Infinity08Commented:
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
palhadeAuthor Commented:
convert a double to a string representation in hexadecimal?
I am using VC++ Express edition
0
 
abelCommented:
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
 
Infinity08Commented:
>> 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
 
abelCommented:
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
All Courses

From novice to tech pro — start learning today.