473,397 Members | 2,056 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Conversion from long/long double to binary

2
How can I convert numbers input as long/long double data type to binary in C/C++???

The program is in 2 parts. First teh program has to change inputs from long(32 bits) to binary and then show the result. Secondly change input from long double(80 bits??) to binary. The codes should be preferably in C++ but maybe in C too its ok.
Feb 21 '07 #1
2 6907
horace1
1,510 Expert 1GB
How can I convert numbers input as long/long double data type to binary in C/C++???

The program is in 2 parts. First teh program has to change inputs from long(32 bits) to binary and then show the result. Secondly change input from long double(80 bits??) to binary. The codes should be preferably in C++ but maybe in C too its ok.
not sure what you want do do - when data is read into the computer e.g. using scanf() in C or cin in C++, it is converted into the internal binary representation, see
http://en.wikipedia.org/wiki/Binary_numeral_system

do you want to print a double in binary, e.g. integer 5 as a 8 bit binary number is 00000101?
Feb 21 '07 #2
mystiq
2
not sure what you want do do - when data is read into the computer e.g. using scanf() in C or cin in C++, it is converted into the internal binary representation, see
http://en.wikipedia.org/wiki/Binary_numeral_system

do you want to print a double in binary, e.g. integer 5 as a 8 bit binary number is 00000101?
Yeah I want to print a long/long double in binary. for instance. I input a number 2,115,000,000 (long data type). How can I convert it to binary?
Feb 21 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: William Payne | last post by:
Hello, I have a variable of type unsigned long. It has a number of bits set (with set I mean they equal one). I need to determine those bits and their position and create new numbers from them. For...
9
by: bowsayge | last post by:
Inspired by fb, Bowsayge decided to write a decimal integer to binary string converter. Perhaps some of the experienced C programmers here can critique it. It allocates probably way too much...
16
by: TTroy | last post by:
Hello, I'm relatively new to C and have gone through more than 4 books on it. None mentioned anything about integral promotion, arithmetic conversion, value preserving and unsigned preserving. ...
6
by: Gilles Rochefort | last post by:
Hello, I wrote the following code to wrap some existing C functions, and I get some warning about converting float to int. float zfactor; int tmp_x, corners_x; ...
5
by: jj_76 | last post by:
hello, I have a data file with several columns consisting of double values. I am reading the whole row as a string using fgets(). I want to convert each column back into a double. It seems...
7
by: somenath | last post by:
Hi All, I am trying to undestand "Type Conversions" from K&R book.I am not able to understand the bellow mentioned text "Conversion rules are more complicated when unsigned operands are...
11
by: Steven Woody | last post by:
long i = nnn; long j; double d; d = i; j = ( long )d; in this case, i == j ? thanks.
1
by: krishna81m | last post by:
I am a newbie and have been trying to understand conversion from double to int and then back to int using the following code was posted on the c++ google group. Could someone help me out with...
2
by: Markus Dehmann | last post by:
I have two integers i1 and i2, the second of which is guaranteed to be between 0 and 99, and I encode them into one double: double encoded = (double)i1 + (double)i2 / (double)100; So, for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.