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 ? ---- Bye, Roland -- __ . . __ (o.\ \/ /.o) [email protected] \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 3992797 (;O/ \/ \O;) _______________________________________________ ast-developers mailing list [email protected] http://lists.research.att.com/mailman/listinfo/ast-developers
