On Mon, 12 Aug 2013 20:15:21 +0200 Roland Mainz wrote:
> On Mon, Aug 12, 2013 at 7:07 PM, Glenn Fowler <[email protected]> wrote:
> > On Mon, 12 Aug 2013 07:29:08 +0200 Irek Szczesniak wrote:
> >> On Mon, Aug 12, 2013 at 1:16 AM, Roland Mainz <[email protected]>
> >> wrote:
> >> > On Mon, Aug 12, 2013 at 12:28 AM, Roland Mainz
> >> > <[email protected]> wrote:
> >> > [Removing [email protected]]
> [snip]
> >> > More thought about this:
> >> > src/cmd/ksh93/data/math.tab could return all three variants (for {
> >> > |float|, |double|, |long double| }) and |fun| in |arith_exec()| would
> >> > be a pointer to an array of these three variants. That would make the
> >> > support for |float| and |double| generic and remove all the
> >> > |if()|/|switch()| mess from the "hot" codepath...
> >
> >> That is IMO the only solution which covers *all* corner cases, i.e. if
> >> an overflow/underflow or creation of subnormal numbers in a math
> >> function happens. Smaller datatypes mean you'll hit the limits earlier
> >> than for larger datatypes and not all float/double functions behave
> >> like doing the same operation with a long double datatype and then
> >> cast the result to the requested datatype.
> >
> > a related question
> > does posix fprintf(3) have a way to print (float) values?
> > I looked a few times and didn't find any
> I'm not sure anymore... but doesn't somehow the varargs rules require
> that the |float| value is promoted to |double| when put in a varargs
> list ?
all printf args are subject to type promotion
so my question was more along the lines of
int default promotion
h for short
hh for char
l for long
ll for long long
double default promotion
L for long double
h and hh require dmotions -- the arg is passed as (unsigned) int and demoted
there is no analog for double => float
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers