fprintf is a variadic function. Therefore any float passed to the function will be automatically promoted to double before the function is called (as long as the prototype is in scope). Since there is no loss on the conversion, the regular floating point formats will work fine. There is no prefix for these formats to differentiate float from double in the language standard.
> -----Original Message----- > From: IBM Mainframe Discussion List [mailto:[email protected]] On > Behalf Of Charles Mills > Sent: Monday, March 13, 2017 3:53 PM > To: [email protected] > Subject: C fprintf() format code for 32-bit float? > > Apologies for the basic question. About everything I know about floating > point could be engraved on the back of a postage stamp. > > For C fprintf() and friends, how do I specify the formatting of a 32-bit > floating point number (C type "float" as opposed to "double))? e, f or g > with some modifier? ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
