This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: this seems to lost (complex norm, abs)
Levente Farkas <lfarkas@mindmaker.hu> writes:
| Gabriel Dos Reis wrote:
| >
| > Levente Farkas <lfarkas@mindmaker.hu> writes:
| >
| > | I would use hypot which probably more "advanced" in most case (i.e.
| >
| > The problem is that a user solution is not always a library solution
| > (and this is an instance of such situations).
|
| I _realy_ thankful for your advice in general and neither I would
| like to criticize anybody who contribute to libstdc++ with my original email.
| And it's not university lecture, but would you explain me the above
| sentence with two or three additional sentence. I assume stdc++
| use standard math functions from libc, so why we cant use hypot here?
On one hand you do want the complex library to behave in a
non-surprising way in unspecified cases; and on the
other hand you do want the library to be implemented in a way that
uses intimate knowledge of builtins.
One one hand you want the library to behave as you want when you
instantiate complex<> with arithmetical types of your choice (other
than float, double and long double) ; and on the
other hand you do want me to use hypot() on types of which I don't the
exact interface. That poisition is incoherent from a library
implementation perspective.
| since stdc++ already check and use hypot (eg. in libmath/stubs.c).
| thanks.
What is the difference between libmath/stubs.c and the implementation
offered in abs(const complex<T>&) which can work with all reasonable
arithmetic types?
-- Gaby