http://d.puremagic.com/issues/show_bug.cgi?id=6154
Summary: std.math.abs on std.complex numbers too Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2011-06-14 05:03:13 PDT --- I'd like std.math.abs to perform what std.complex.Complex!T.abs does. So I will be able to use it functionally (currently std.math.abs is able to work on the built-in complex numbers too). This means I'd like this code to work: import std.stdio, std.math, std.algorithm, std.complex; void main() { alias Complex!double C; C[] array2 = [C(1,2), C(2,4)]; auto m2 = map!abs(array2); writeln(m2); } In DMD 2.053 similar code with built-in complex numbers works: import std.stdio, std.math, std.algorithm; void main() { cdouble[] array1 = [1+2i, 2+4i]; auto m1 = map!abs(array1); writeln(m1); } In DMD 2.053 if you want to do the same with complex numbers you need to write: import std.stdio, std.math, std.algorithm, std.complex; void main() { alias Complex!double C; C[] array2 = [C(1,2), C(2,4)]; auto m2 = map!((c){ return c.abs(); })(array2); writeln(m2); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------