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