Re: log for complex

2018-03-07 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Mar 07, 2018 at 10:47:40AM +, J-S Caux via Digitalmars-d-learn wrote: > On Wednesday, 7 March 2018 at 10:28:23 UTC, Simen Kjærås wrote: > > On Wednesday, 7 March 2018 at 10:10:49 UTC, J-S Caux wrote: > > > On Wednesday, 7 March 2018 at 08:04:36 UTC, Simen Kjærås wrote: > > > > auto log

Re: log for complex

2018-03-07 Thread J-S Caux via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 10:28:23 UTC, Simen Kjærås wrote: On Wednesday, 7 March 2018 at 10:10:49 UTC, J-S Caux wrote: On Wednesday, 7 March 2018 at 08:04:36 UTC, Simen Kjærås wrote: auto log(T)(Complex!T x) { import std.math : log; return Complex!T(log(abs(x)), arg(x)); } Yes in

Re: log for complex

2018-03-07 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 10:10:49 UTC, J-S Caux wrote: On Wednesday, 7 March 2018 at 08:04:36 UTC, Simen Kjærås wrote: auto log(T)(Complex!T x) { import std.math : log; return Complex!T(log(abs(x)), arg(x)); } Yes indeed I can do this, but isn't this inefficient as compared to wh

Re: log for complex

2018-03-07 Thread J-S Caux via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 08:04:36 UTC, Simen Kjærås wrote: On Wednesday, 7 March 2018 at 07:42:37 UTC, J-S Caux wrote: Simple question: how do I get the log of a complex number? If I try the simple logtest = log(complex(1.0, 2.0)) I get the compiler error Error: function core.stdc.math.l

Re: log for complex

2018-03-07 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 07:42:37 UTC, J-S Caux wrote: Simple question: how do I get the log of a complex number? If I try the simple logtest = log(complex(1.0, 2.0)) I get the compiler error Error: function core.stdc.math.log(double x) is not callable using argument types (Complex!doubl