Topic: Data types, quad precision
Author: TROCKE@uwplatt.edu (Trocke Robert Stephen)
Date: 31 Aug 1994 21:15:15 GMT Raw View
I know that standard c++ does not in (any?) its many forms contain a quad
precision floating point data type. Does anyone know of any manifestation
of this that has been implemented, or simple math functions (I'm acutally
going to be working with matrix manipulations) in quad precision?
The application is going to be the inversion of a matrix of nth degree
polynomials. Quad precision has been shown to be necessary to a useful
result.
Any pointers, references, addresses of friends, addresses of enemies, that
can help me on this will gain my utmost gratitude.
Thanks,
Bob
----------------------------------------------------------------------------
Bob Trocke "Why does the universe go through
ucsbst@ucs.uwplatt.edu all the trouble of existing anyway?"
Dept. of Electrical Engineering -Stephen Hawking
University of Wisconsin - Platteville
Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 1 Sep 1994 18:32:01 GMT Raw View
In article adn@althea.ucs.uwplatt.edu, TROCKE@uwplatt.edu (Trocke Robert Stephen) writes:
>I know that standard c++ does not in (any?) its many forms contain a quad
>precision floating point data type.
Type "long double" is a standard C and C++ data type. Its definition depends
on the implementation, but when it is not the same as "double", it is
typically 80 bits or more. Check the documentation for long double on your system.
---
Steve Clamage, stephen.clamage@eng.sun.com
Author: rfg@netcom.com (Ronald F. Guilmette)
Date: Thu, 1 Sep 1994 18:52:06 GMT Raw View
In article <342rt3$adn@althea.ucs.uwplatt.edu> TROCKE@uwplatt.edu (Trocke Robert Stephen) writes:
>I know that standard c++ does not in (any?) its many forms contain a quad
>precision floating point data type.
Not per se, no.
> Does anyone know of any manifestation of this that has been implemented...
By `quad precision' I assume you mean some floating-point type which carries
more precision than what is normally called type `double' in C and C++.
Neither the C standard nor the forthcoming C++ standard will specify any
precise or specific requirements with respect to the representation of
the three standard built-in floating-point types available in these
languages (i.e. `float', `double', and `long double'). Both standards
will however specify some minimum amounts of range and precision for each
of these types, but as long as an implementation satisfies those minimal
requirements, it can be called ``standard conforming''.
The requirements set forth in the C standard (and now included, by reference,
in the draft C++ standard) allow the representation of type `long double'
to be the same as type `double', and some implementations *do* in fact
represent both of these types in exactly that same way. However, there
are also many implementation (of C and C++) where the type `long double'
is represented with more precision than type `double'.
For example, on Intel x86-based systems, as well as on Motorola 680x0-based
systems, the type `double' is typically represented by an 8-byte long
floating-point number, whereas type `long double' is often represented as
a 12-byte long floating-point number. You might say that this is not
really quad-precision, but rather tri-precision, because ``single-precision''
floating-point numbers on these machines are typically 4 bytes long.
Some other kinds of hardware (e.g. Sun Sparc) do in fact support a true
quad-precision data type which is represented using a 16-byte long format.
If you are lucky, you may even be able to find a C and/or C++ compiler
for such a system which will use this 16-byte floating-point format to
represent the `long double' data type in C and/or C++. (Newer compilers
for Sun Sparc do this, but older compilers do not.) I believe that systems
based upon the HP Precision Architecture and the PowerPC Architecture can
also support a 16-byte floating-point type, but I confess that I'm not
really sure about these.
If you want to know what floating-point formats are being used by your
compiler, just write a little program to print out the values of:
sizeof(float)
sizeof(double)
sizeof(long double)
>... or simple math functions (I'm acutally
>going to be working with matrix manipulations) in quad precision?
As far as I know, NONE of the standard math functions which are currently
specified in the C standard, and NONE of the standard math functions which
will be provided in the forthcoming C++ standard take arguments or return
results which have the `long double' type. In general, the standard library
functions take arguments and return results having type `double'.
(It might be reasonable to revisit and reconsider that decision during the
development of the C++ standard, but to the best of my knowledge, no one
has yet proposed that. In C++, it would be very easy to have *families*
of overloaded math functions which take different floating-point argument
types, and which return matching floating-point result types.)
Please direct follow-ups on this posting ONLY to comp.lang.c++ and comp.lang.c
unless you are going to make a point about the current C++ standardization
effort, and the direction it should take with respect to the floating-point
issues discussed herein.
--
-- Ron Guilmette, Sunnyvale, CA ---------- RG Consulting -------------------
---- domain addr: rfg@netcom.com ----------- Purveyors of Compiler Test ----
---- uucp addr: ...!uunet!netcom!rfg ------- Suites and Bullet-Proof Shoes -