Article View: gnu.gcc.help
Article #51246Re: 'long double' support?
From: Stephen L Moshier
Date: Sun, 20 Jun 1993 22:49
Date: Sun, 20 Jun 1993 22:49
33 lines
1633 bytes
1633 bytes
This problem is in printf, not in the compiler. Sun's printf does
not know about long doubles. You can change
printf("%.15Lg\n", myvar);
to
printf("%.15g\n", (double) myvar);
or you can use the function e64toasc in real.c for printing -- link real.o to
your program.
>As near as I can tell from the doc, the 'long double' extended floating point
>format is supported by gcc-2.4 on 68000-based machines that have a 68881 fpa.
>On a sun3 which meets the above criteria, I compiled and ran the following
>program with gcc-2.4.2:
>main()
>{
>long double myvar;
>myvar = 1.0 + 1.0e-14;
>printf("%.15Lg\n", myvar);
>}
>And I got the following output:
>1.00000762939453
>Whereas if I replace the long double with a double and the L with an l,
>it gives the expected output:
>1.00000000000001
>Is this a known bug? Is there a fix?
>--
>Mark J. Reed <mark@cad.gatech.edu>
>Georgia Institute of Technology
Technical Details
Message-ID:
<C8xzF5.32L@world.std.com>Path:
arc1-ca.pugleaf.net!gmd.de!rrz.uni-koeln.de!unidui!math.fu-berlin.de!news.dfn.de!scsing.switch.ch!news.univie.ac.at!paladin.american.edu!howland.reston.ans.net!noc.near.net!uunet!world!moshierReferences:
<1vbit8$5p3@cae.cad.gatech.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,ecb78f9ae9b7a074,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-06-20 16:35:52 PST Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!gmd.de!rrz.uni-koeln.de!unidui!math.fu-berlin.de!news.dfn.de!scsing.switch.ch!news.univie.ac.at!paladin.american.edu!howland.reston.ans.net!noc.near.net!uunet!world!moshier From: moshier@world.std.com (Stephen L Moshier) Subject: Re: 'long double' support? Message-ID: <C8xzF5.32L@world.std.com> Organization: The World Public Access UNIX, Brookline, MA References: <1vbit8$5p3@cae.cad.gatech.edu> Distribution: usa Date: Sun, 20 Jun 1993 22:49:52 GMT Lines: 33