Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

double to hexadecimal

Posted on 2009-05-15
9
Medium Priority
?
457 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 39

Accepted Solution

by:
abel earned 2000 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

670 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