Re: Problem with using std.math: abs and std.complex: abs at the same time

2019-09-19 Thread berni via Digitalmars-d-learn
On Thursday, 19 September 2019 at 11:16:12 UTC, Simen Kjærås wrote: Might I ask what specifically you're working on? Of course. It's about issue 15881 (and 15763), namely approxEqual not always doing, what people think it should do. (As a side note: I stumbled over this, when I wanted to

Re: Problem with using std.math: abs and std.complex: abs at the same time

2019-09-19 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 19 September 2019 at 10:25:01 UTC, berni wrote: On Thursday, 19 September 2019 at 07:26:17 UTC, Simen Kjærås wrote: That does indeed fail to compile, and there's no easy way to introduce the module-level abs() function to the scope. Again though, MergeOverloads to the rescue:

Re: Problem with using std.math: abs and std.complex: abs at the same time

2019-09-19 Thread berni via Digitalmars-d-learn
On Thursday, 19 September 2019 at 07:26:17 UTC, Simen Kjærås wrote: That does indeed fail to compile, and there's no easy way to introduce the module-level abs() function to the scope. Again though, MergeOverloads to the rescue: I'm not sure, if MergeOverloads will be accepted into

Re: Problem with using std.math: abs and std.complex: abs at the same time

2019-09-19 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 18 September 2019 at 13:24:05 UTC, berni wrote: On Wednesday, 18 September 2019 at 12:37:28 UTC, Simen Kjærås wrote: How to resolve this, though? The simplest solution is to not use selective imports: import std.math; import std.complex;

Re: Problem with using std.math: abs and std.complex: abs at the same time

2019-09-18 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Sep 18, 2019 at 12:37:28PM +, Simen Kjærås via Digitalmars-d-learn wrote: [...] > template MergeOverloads(T...) { > alias MergeOverloads = T[0]; > static if (T.length > 1) { > alias MergeOverloads = MergeOverloads!(T[1..$]); > } > } > > I would however label that

Re: Problem with using std.math: abs and std.complex: abs at the same time

2019-09-18 Thread berni via Digitalmars-d-learn
On Wednesday, 18 September 2019 at 12:37:28 UTC, Simen Kjærås wrote: How to resolve this, though? The simplest solution is to not use selective imports: import std.math; import std.complex; writeln(abs(complex(1.0,1.0))); writeln(abs(1.0)); That works. But: I'm trying to

Re: Problem with using std.math: abs and std.complex: abs at the same time

2019-09-18 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 18 September 2019 at 12:03:28 UTC, berni wrote: The following code doesn't compile: import std.stdio; void main() { import std.complex: abs, complex; import std.math: abs; auto a = complex(1.0,1.0); auto b = 1.0; writeln(abs(a)); writeln(abs(b)); } The

Re: Problem with using std.math: abs and std.complex: abs at the same time

2019-09-18 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Sep 18, 2019 at 2:05 PM berni via Digitalmars-d-learn wrote: > > The following code doesn't compile: > > >import std.stdio; > > > >void main() > >{ > >import std.complex: abs, complex; > >import std.math: abs; > > > >auto a = complex(1.0,1.0); > >auto b = 1.0; > > > >

Re: Problem with using std.math: abs and std.complex: abs at the same time

2019-09-18 Thread Andrea Fontana via Digitalmars-d-learn
On Wednesday, 18 September 2019 at 12:03:28 UTC, berni wrote: The following code doesn't compile: import std.stdio; void main() { import std.complex: abs, complex; import std.math: abs; auto a = complex(1.0,1.0); auto b = 1.0; writeln(abs(a)); writeln(abs(b)); } What

Problem with using std.math: abs and std.complex: abs at the same time

2019-09-18 Thread berni via Digitalmars-d-learn
The following code doesn't compile: import std.stdio; void main() { import std.complex: abs, complex; import std.math: abs; auto a = complex(1.0,1.0); auto b = 1.0; writeln(abs(a)); writeln(abs(b)); } The error message depends on the order of the two import statements.