July 17, 2014 [phobos] [D-Programming-Language/phobos] 3b2fb2: Enhancement request 13022: add `std.complex.sqAbs` | ||||
---|---|---|---|---|
| ||||
Attachments:
| Branch: refs/heads/master Home: https://github.com/D-Programming-Language/phobos Commit: 3b2fb2ea51e7dc771b5dee69a42c2abde6946961 https://github.com/D-Programming-Language/phobos/commit/3b2fb2ea51e7dc771b5dee69a42c2abde6946961 Author: Jean-Loup Tastet <jean-loup.tastet@epfl.ch> Date: 2014-07-03 (Thu, 03 Jul 2014) Changed paths: M std/complex.d Log Message: ----------- Enhancement request 13022: add `std.complex.sqAbs` Add `std.complex.abs2`, which returns the squared modulus of a `Complex` or real number. Rationale: * It is common to need the squared modulus of a complex number, and using `abs(z)*abs(z)` would be inefficient due to the computation of the square root. * The name `abs2` has been chosen for consistency with `abs`, and for being mathematically more correct than `norm`, used by C++ STL for the equivalent function. * For genericity, the function `abs2` is also declared for real floating point numbers, in which case it simply returns its square. UPDATE: use `sqAbs` instead of `abs2`. Commit: 82dc45e886621cabb7d00e528c22bf6eb8869f89 https://github.com/D-Programming-Language/phobos/commit/82dc45e886621cabb7d00e528c22bf6eb8869f89 Author: Михаил Страшун <public@dicebot.lv> Date: 2014-07-17 (Thu, 17 Jul 2014) Changed paths: M std/complex.d Log Message: ----------- Merge pull request #2297 from Element-126/add_std_complex_abs2 Enhancement request 13022: add `std.complex.abs2` Compare: https://github.com/D-Programming-Language/phobos/compare/78e5ebe29304...82dc45e88662 |
Copyright © 1999-2021 by the D Language Foundation