how has C bitten you?
Alan T. Bowler [SDG]
atbowler at watmath.UUCP
Mon Aug 12 04:57:22 AEST 1985
In article <505 at brl-tgr.ARPA> mbarker at BBNZ.ARPA (Michael Barker) writes:
>>So, printf can never get a float as an argument, it always gets a double.
>>Therefore, %lf or %F are meaningless to printf.
>>
>>Brian Jones aka {ihnp4,}!drutx!qwerty @ AT&T-IS
>
>Brian (et al) - the reasoning is correct, but printf could easily be changed to
>accept %lf or %F (or any useful convention) as formatting directions for a
>value with the knowledge that the value will *actually* be a double. Let's try
I thought that the implicit promotion of float to double on passing
an argument was one of the things that was going away with the
new C standard. It certainly has been high on my personal hit list.
I grant that there was a reasonable case for it when C was just for
PDP-11's. But these days when there is a good possibility that
floating point is being handled by a software implementation of
the IEEE standard, it is a loser. In this situation the conversion
between float and double is a reasonably expensive operation,
and really should only be done when the programmer explicitly asks for it.
More information about the Comp.lang.c
mailing list