no. of byte problem

F

FrancisC

hello,
I want to ask how many bytes do these ocupy respectively:

(double) 1.23456789012345E+05 and the E+05 part

and if I want to represent the number up to the first eight digits only,
i.e. 1.234567E+05
what is the representation of using the least bytes?
thank you
 
J

Jack Klein

hello,
I want to ask how many bytes do these ocupy respectively:

(double) 1.23456789012345E+05 and the E+05 part

It occupies sizeof(double) bytes on every single C implementation in
existence. Exactly how many bytes that is, and how many bits are in
each of those bytes, varies from one implementation to the other.

But I am pretty sure there are no implementations in current use today
that use a radix of 10 for floating point, so the "E+05" part probably
occupies some number of bits, quite possibly with an offset.
and if I want to represent the number up to the first eight digits only,
i.e. 1.234567E+05
what is the representation of using the least bytes?
thank you

That depends on your implementation. A float might or might not be
able to hold 8 decimal digits of precision. Take a look at your
compiler's <float.h> header or documentation, and it will tell you.

But it might not save you any size, float, double, and long double can
all be the same size and have the same representation.

This is all defined by your particular implementation, not the
language, as long as your compiler meets the minimum requirements
specified in the C standard. Either read your compiler's
documentation or ask in a compiler-specific support group.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,207
Latest member
HelenaCani

Latest Threads

Top