Because forintf() has a variadic argument list the float is converted to a 
double. This is called "default argument promotions". You may want to dig out a 
copy of the C99 standard. 

> On 14 Mar 2017, at 7:55 am, Charles Mills <charl...@mcn.org> wrote:
> 
> OK. I just coded a static_cast on @Gil's suggestion. Should not hurt 
> anything; actually makes the code a little clearer, except for all the <> and 
> () LOL.
> 
> Charles
> 
> 
> -----Original Message-----
> From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On 
> Behalf Of Farley, Peter x23353
> Sent: Monday, March 13, 2017 4:32 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: C fprintf() format code for 32-bit float?
> 
> I believe that formatting types e/E, f/F and g/G will all handle float, 
> double and long double without casts.
> 
> Example CELEBF30 available in the Runtime Library Reference under:
> 
> Library Functions
> fprintf(), printf() and sprint() - Format and write data
> 
> Shows a float printed with g and G specifiers with no cast.
> 
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to