[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pcc-list
Subject:    Re: [Pcc] does posix fprintf(3) have a way to print (float) values?
From:       "Fred J. Tydeman" <tydeman () tybor ! com>
Date:       2013-08-14 15:03:49
Message-ID: 100.10f10800559c0b52.018 () tybor ! com
[Download RAW message or body]

On Wed, 14 Aug 2013 13:07:11 +0200 Anders Magnusson wrote:
>
>C99 says that if you have an ellipsis prototype, the behaviour is undefined.
>On the other hand, if you do not have any prototype at all, float will be 
>promoted to double.
>
>See 6.5.2.2 clause 6 for details.

That is for functions that are defined with ellipsis prototype.

6.5.2.2 paragraph 6 mentions default argument promotions.
So, float is promoted to double for 
  no prototype
  prototype and argument matches the ... part

6.5.2.2, paragraph 7 also says default argument promotions
are done for arguments that match the ... part.

That is for functions that are declared with ellipsis prototype
(e.g., #include <stdio.h>)

>On 08/12/2013 07:46 PM,   wrote:
>>Does posix fprintf(3) have a way to print (float) values? I think they
>>are automatically casted to a double, or not?

Correct, float is promoted to double for fprintf().


---
Fred J. Tydeman        Tydeman Consulting
tydeman@tybor.com      Testing, numerics, programming
+1 (775) 287-5904      Vice-chair of PL22.11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.
_______________________________________________
Pcc mailing list
Pcc@lists.ludd.ltu.se
http://lists.ludd.ltu.se/cgi-bin/mailman/listinfo/pcc
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic