this seems to lost (complex norm, abs)
Theodore Papadopoulo
Theodore.Papadopoulo@sophia.inria.fr
Thu Sep 20 05:57:00 GMT 2001
lfarkas@mindmaker.hu said:
> it contains 2 abs, 2 addition, 2 division, 3 multilication and 1 sqrt
> may be a few cosine and tan help a bit more:-) while the trivial
> "grammar school implementation": sqrt(norm(__z))
> contains 1 addition, 2 multilication, 1 sqrt
> so why we use it? may be in case of __z == 0 it's faster a bit, so an
This is done to avoid overflow. Take eg, x = sqrt(DOUBLE_MAX)+epsilon
and y=0, your formula will overflow (yelding +Infinity) while the used formula
will give the proper result.
--------------------------------------------------------------------
Theodore Papadopoulo
Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
--------------------------------------------------------------------
--
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Exmh version 2.2 06/23/2000
iD8DBQE7qeeYIzTj8qrxOU4RAhCSAKCWSMs4opmG2qdnyk+/Y26W+YVNlQCbBpwN
RrCsRJBf446FuWHYoCHDKXQ=
=JRzp
-----END PGP SIGNATURE-----
More information about the Libstdc++
mailing list