Article View: gnu.gcc.bug
Article #2445Small floating point constants are doubles?
From: Paul Hudson
Date: Wed, 22 Mar 1989 15:53
Date: Wed, 22 Mar 1989 15:53
24 lines
1179 bytes
1179 bytes
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.
Not having an up-to-date ANSI C draft to hand I can't say whether this is allowed by the standard.
but it would be useful!
Paul Hudson
Snail mail: Monotype ADG Email: ...!ukc!acorn!moncam!paul
Science Park, paul@moncam.co.uk
Milton Road, "Sun Microsysytems:
Cambridge, The Company is Arrogant (TM)"
CB4 4FQ
Technical Details
Message-ID:
<8903221553.AA04823@marvin.moncam.uucp>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!UUNET.UU.NET!mcvax!moncam!paulShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!UUNET.UU.NET!mcvax!moncam!paul From: mcvax!moncam!paul@UUNET.UU.NET (Paul Hudson) Newsgroups: gnu.gcc.bug Subject: Small floating point constants are doubles? Message-ID: <8903221553.AA04823@marvin.moncam.uucp> Date: 22 Mar 89 15:53:03 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 24