Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > floats doubles long doubles

Reply
Thread Tools

floats doubles long doubles

 
 
dan
Guest
Posts: n/a
 
      11-26-2003
Can someone tell me the difference between these three data types?

Thanks

Daniel
 
Reply With Quote
 
 
 
 
Jack Klein
Guest
Posts: n/a
 
      11-26-2003
On 25 Nov 2003 20:19:44 -0800, http://www.velocityreviews.com/forums/(E-Mail Removed) (dan) wrote in
comp.lang.c++:

> Can someone tell me the difference between these three data types?
>
> Thanks
>
> Daniel


There may no be any.

The C++ language inherits these floating point types from C. C and
C++ allow, but does not require, three different floating point types.

Each floating point type has certain minimum specifications that it
must meet.

A 32 bit IEEE single precision representation fully meets the
requirements of a float in C and C++, and is what almost all platforms
and compilers use today. It does not meet the requirements for the
wider types.

A 64 bit IEEE double precision representation fully meets the
requirements of both double and long double in C and C++. This is
what almost all platforms and compilers use today for double.

Some hardware architectures (example, Intel x86) provide hardware
support for even higher precision, such as the Intel FPU 80 bit
extended precision format. Some hardware platforms do not.

Even on platforms where there is hardware support for long double to
have more precision than double, there is no requirement for a
compiler to support it. The requirements for double and long double
in C and C++ are identical.

For example, Microsoft 32 bit compilers for x86 do not support the 80
bit extended precision format, although their older 16 bit compilers
did. So double and long double are exactly the same representation in
Visual C++ programs. On the other hand, other compilers for the same
processors such as Borland and GCC do use the 80 bit format, so long
double has more precision and range than double.

--
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do you convert and array of doubles into floats? SpreadTooThin Python 7 09-16-2006 01:14 AM
++ / -- operators with floats and doubles my.correo.basura@gmail.com C Programming 14 05-26-2005 12:59 PM
Re: Floats, doubles C and MSVC Andrew Reilly C Programming 2 10-14-2004 02:50 PM
Problems with multiplications of doubles and/or floats J.K. Becker C++ 43 04-23-2004 10:41 PM
Comparing two floats or doubles to a precision {AGUT2} {H}-IWIK C++ 4 09-12-2003 02:51 PM



Advertisments