Article View: gnu.gcc.bug
Article #2451Re: Small floating point constants are doubles?
From: Dave Hanson
Date: Thu, 23 Mar 1989 17:13
Date: Thu, 23 Mar 1989 17:13
13 lines
1262 bytes
1262 bytes
In article <8903221553.AA04823@marvin.moncam.uucp> mcvax!moncam!paul@UUNET.UU.NET (Paul Hudson) writes:
A small floating point constant in gcc has type double.
This can cause unwanted promotions of other objects to doubles, like
float h() { float f; ... return f * 2.0; }
as a trivial example. This has an "unnecessary" promotion of f to
double, and a shortening to float again on the return. It would be nice
if sufficiently small/imprecise constants could be of float type at
least as an option, if not by default.
this is correct as specified in the ANSI standard;
if you want float constants, use suffix "F", e.g., 2.0F.
Technical Details
Message-ID:
<15894@princeton.Princeton.EDU>Path:
arc1-ca.pugleaf.net!utzoo!yunexus!telly!attcan!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucsd!rutgers!njin!princeton!notecnirp!drhReferences:
<8903221553.AA04823@marvin.moncam.uucp>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!yunexus!telly!attcan!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucsd!rutgers!njin!princeton!notecnirp!drh From: drh@notecnirp.Princeton.EDU (Dave Hanson) Newsgroups: gnu.gcc.bug Subject: Re: Small floating point constants are doubles? Message-ID: <15894@princeton.Princeton.EDU> Date: 23 Mar 89 17:13:42 GMT Article-I.D.: princeto.15894 References: <8903221553.AA04823@marvin.moncam.uucp> Sender: news@princeton.Princeton.EDU Reply-To: drh@notecnirp.UUCP (Dave Hanson) Distribution: gnu Organization: Dept. of Computer Science, Princeton University Lines: 13