Re: double vs float
- From: Jack Klein <jackklein@xxxxxxxxxxx>
- Date: Sat, 03 Mar 2007 23:47:11 -0600
On 3 Mar 2007 19:48:49 -0800, "santosh" <santosh.k83@xxxxxxxxx> wrote
in comp.lang.c:
subramanian100in@xxxxxxxxx, India wrote:
In the post with heading "Learning C - Scanf or Getch, or Getchar not
working correctly after first loop" that appears in today's list in
comp.lang.c,
it has been mentioned in the answer to this post, that double should
be preferred to float when space is not a constraint.
Can someone explain why double should be preferred to float ?
Usually it's because double corresponds more closely with the system's
native floating point type than float. Also, it gives more range and
precision than float, which is an important point when using floating-
point types.
What system is it that has "a" native floating point type, only one
that is, that corresponds more closely to double than float?
Your answer makes no sense at all, for several reasons:
1. If a platform only has a single floating point type supported in
hardware, and it meets the requirements for C's double, there is
nothing at all preventing the C implementation from using it for float
as well.
2. I can't think of any hardware architecture off-hand that has
hardware floating point for something suitable for a double, such as
64 bits or more, that does not also have hardware support for a
narrower floating point type.
On the other hand, I know of quite a few platforms where the opposite
is true, including 32-bit controllers and DSPs, namely that they have
hardware 32-bit floating point, which meets the C requirements for
float, but not a wider hardware floating point type.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
.
- Follow-Ups:
- Re: double vs float
- From: pete
- Re: double vs float
- From: santosh
- Re: double vs float
- References:
- double vs float
- From: subramanian100in@xxxxxxxxx, India
- Re: double vs float
- From: santosh
- double vs float
- Prev by Date: Re: C Strings
- Next by Date: Re: C container and persistent library ?
- Previous by thread: Re: double vs float
- Next by thread: Re: double vs float
- Index(es):
Relevant Pages
|
|