need a simple binary to decimal conversion in C platform and represent that decimal number in IEEE format ?

gravity4u
gravity4u used Ask the Experts™
on
can some help me to have simple binary to decimal conversion in C and represent that decimal number in IEEE format ? plz i need it ... can some 1...
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Is it a string, the binary? Like "011010"? In that case, just make a simple loop and increase the decimal value for each '1' you find in the string. The above would be 2^1 + 2^4 + 2^5, right? Then convert your decimal to a string.

Hope it helped...

/Killen
ozo
Most Valuable Expert 2014
Top Expert 2015
Commented:
#include <stdlib.h>
#include <stdio.h>
printf("%ld\n",strtol("011010",0,2));
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Recommendation: Split points between Killen and ozo

------ Frankly neither Expert has given a complete answer, and the question looks like an abandoned homework assignment. Still - both approaches constitute useful advice for a beginner trying to tackle this problem.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

DominicCronin
EE Cleanup Volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial