[comp.lang.c] what belongs in <math.h>

karl@haddock.ISC.COM (Karl Heuer) (04/09/88)

In article <10068@tut.cis.ohio-state.edu> lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) writes:
>I was shocked when I read that abs() was taken out of <math.h> ... abs() is a
>math function and <math.h> is where it belongs!

Taken out?  Was it ever *in* math.h?  I just checked two systems (one BSD, one
USGish), and neither declares the abs() function in any header.  (Why should
they?  The default declaration suffices.$)  Neither one puts the code in
libm.a, either.  I don't think it's clear that it "belongs" in <math.h>.

Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint
$This is not my argument, but (my interpretation of) the implementors'.

lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) (04/09/88)

In article <3377@haddock.ISC.COM>, karl@haddock.ISC.COM (Karl Heuer) writes:
> In article <10068@tut.cis.ohio-state.edu> lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) writes:
> >I was shocked when I read that abs() was taken out of <math.h> ... abs() is a
> >math function and <math.h> is where it belongs!
> 
> Taken out?  Was it ever *in* math.h?  I just checked two systems (one BSD, one

Thats what the rationale said, but the rational is wrong, see 4.10.6.
If it was in <math.h> then it should have stayed there, vendors stupid
compilers notwithstanding.  I don't use <math.h> so I didn't know any
better when I read 4.10.6.

> USGish), and neither declares the abs() function in any header.  (Why should
> they?  The default declaration suffices.$)  Neither one puts the code in
> libm.a, either.  I don't think it's clear that it "belongs" in <math.h>.

What default declaration suffices for what?  The argument types need to
be declared with a function prototype.  I could live without abs() being
in <math.h> as long as it was in *some* header files.

-- 
Larry Cipriani, AT&T Network Systems and Ohio State University
Domain: lvc@tut.cis.ohio-state.edu
Path: ...!cbosgd!osu-cis!tut.cis.ohio-state.edu!lvc (weird but right)