Re: long double support on 80x86 C++ Win32 compilers

Andi Kleen <ak@muc.de>
10 Aug 1998 23:27:28 -0400

          From comp.compilers

Related articles
long double support on 80x86 C++ Win32 compilers comments@cygnus-software.com (Bruce Dawson) (1998-08-10)
Re: long double support on 80x86 C++ Win32 compilers ak@muc.de (Andi Kleen) (1998-08-10)
Re: long double support on 80x86 C++ Win32 compilers michael_ross@ccm.intel.com (Michael Ross) (1998-08-10)
Re: long double support on 80x86 C++ Win32 compilers mfinney@lynchburg.net (1998-08-13)
Re: long double support on 80x86 C++ Win32 compilers comments@cygnus-software.com (Bruce Dawson) (1998-08-16)
| List of all articles for this month |
From: Andi Kleen <ak@muc.de>
Newsgroups: comp.compilers
Date: 10 Aug 1998 23:27:28 -0400
Organization: [posted via] Leibniz-Rechenzentrum, Muenchen (Germany)
References: 98-08-061
Keywords: C, 386, arithmetic

Bruce Dawson <comments@cygnus-software.com> writes:
> [ who supports long double values on x86 ? ]


The Win32 port of gcc does (cygwin32). The compiler is freely available.


> The following (C - sorry) test program can be used to see how large a
> floating point number fits into a compiler's long double. An eight
> byte double overflows around 1e350, a ten byte double overflows far
> beyond that.


> #include <stdio.h>


> int main(int argc, char *argv[])
> {
> long double x = 123456789;
> for (int i = 0; i < 10; i++)
> {
> x *= x;
> printf("x = %g\n", x);
                                      ^^^^
                          Should be %Lg
> }
> return 0;
> }


This program is buggy. See above. At least on linux/x86 it will print wrong
values (but gcc catches it of course when compiled with -Wall)


-Andi
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.