--- Nicholas Clark <[EMAIL PROTECTED]> wrote: > On Fri, Jan 17, 2003 at 12:21:33PM -0500, Dan Sugalski wrote: > > Sorry this one sat. I want to apply it, but the test patch looks to > > On Tue, Jan 14, 2003 at 04:53:25PM +0000, Bernhard Schmalhofer wrote: > > For the operator 'abs' I use the functions 'abs()' and 'fabs()' from the > > C math library. 'abs()' might be problematic, as it isn't in the C99 > > standard, http://std.dkuug.dk/JTC1/SC22/WG14/www/standards. > > fabs() is in C89 and C99. > > ??? > > Dan, problem, surely? Unless/until we work around things we want being > absent. In this case it's more getting the Configure infrastructure in > place > to probe for the missing functions > > Secondly, these routines assume that INTVAL is an int (not a long, nor > heresy), and that FLOATVAL is a double. I believe we can't make that > assumption: > > > inline op abs( inout INT) { > > $1 = abs( $1 ); > > goto NEXT(); > > } > > > > inline op abs(inout NUM) { > > $1 = fabs( $1 ); > > goto NEXT(); > > } > > > > inline op abs(out INT, in INT) { > > $1 = abs( $2 ); > > goto NEXT(); > > } > > > > inline op abs(out INT, in NUM) { > > $1 = (INTVAL)fabs($2); > > goto NEXT(); > > } > > > > inline op abs(out NUM, in INT) { > > $1 = (FLOATVAL)abs($2); > > goto NEXT(); > > } > > > > inline op abs(out NUM, in NUM) { > > $1 = fabs( $2 ); > > goto NEXT(); > > } > > We'd need more complex code to conditionally use fabs, fabsf, fabsl > (or work around absence of fabsf and fabsl), and abs, labs, llabs > (and work around the last one being missing) > > We could make the call that we're not going to work around missing long > double functions - if you ain't got 'em, we refuse to Configure for that > size. > Given that if you don't have fabsl, you probably don't have more tricky > functions such as sqrtl, modfl or atan2l > > Nicholas Clark
We could always use the old standby: inline op abs(inout INT) if($1 < 0) $1 = -$1; goto NEXT(); } __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com