Topic: Where does float std::abs(float) come from: cmath or cstdlib?


Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 1999/02/10
Raw View
Olaf Weber <olaf@infovore.xs4all.nl> writes:

>On reading section 26.5 of the standard, I became a bit confused.  It
>says (26.5.5):

> In addition to the `double' versions of the math functions in
> `<cmath>', C++ adds `float' and `long double' overloaded
> versions of these functions, with the same semantics.

>`float abs(float)' is one of the functions named.  From this I would
>infer that it is declared in `<cmath>'.  On the other hand, `abs' is
>not mentioned in table 80, "Header `<cmath>' synopsis", only in table
>81, "Header `<cstdlib>' synopsis".

>Which header does contain the declaration of `float std::abs(float)':
><cmath>, <cstdlib>, or both?  If <cmath>, shouldn't it have been added
>to tabel 81?

In section 26.5, paragraphs 2-4 refer to <cstdlib>, and say that
abs(long) is in that header.

The remainder of the section refers to <cmath>, and lists
abs(float), abs(double), and abs(long double) as being in
<cmath>.

Evidently, abs was omitted from Table 80. I don't know whether
that was intentional, but it seems like it shouuld be there as
well as in Table 81.

--
Steve Clamage, stephen.clamage@sun.com
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: Olaf Weber <olaf@infovore.xs4all.nl>
Date: 1999/02/09
Raw View
On reading section 26.5 of the standard, I became a bit confused.  It
says (26.5.5):

 In addition to the `double' versions of the math functions in
 `<cmath>', C++ adds `float' and `long double' overloaded
 versions of these functions, with the same semantics.

`float abs(float)' is one of the functions named.  From this I would
infer that it is declared in `<cmath>'.  On the other hand, `abs' is
not mentioned in table 80, "Header `<cmath>' synopsis", only in table
81, "Header `<cstdlib>' synopsis".

Which header does contain the declaration of `float std::abs(float)':
<cmath>, <cstdlib>, or both?  If <cmath>, shouldn't it have been added
to tabel 81?

--
Olaf Weber

Do not meddle in the affairs of sysadmins,
        for they are quick to anger and have no need for subtlety.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]