Solved

double to hexadecimal

Posted on 2009-05-15
9
454 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 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
basic hardware to learn oop advanced design patterns 3 120
How can i compile this github project?? 2 101
Super Scope, DHCP 5 100
I could not set window to top 4 60
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
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 how to create, access, and change arrays in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

738 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