Re: issue with each specifically for x86

2018-03-07 Thread Ali Çehreli via Digitalmars-d-learn
On 03/07/2018 10:57 AM, Matt Gamble wrote: This is a record for me with two 32bit vs 64bit issues in one day. Seems to be a problem with using "each" under 32bit which can be fixed by using foreach or switching to x64. Am I doing something wrong or is this the second bug I've found today?

Re: How can I get notified when an process created by spawnShell() has exit?

2018-03-07 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 15:03:28 UTC, Marc wrote: I do need to start (up to 4 a time) processes in parallel but I'd like to get notified (similar to C#'s Process.Exited Event) when the process exits. How can I do that in D? You can use pipeShell and a control loop to check when the

Re: issue with each specifically for x86

2018-03-07 Thread ketmar via Digitalmars-d-learn
Steven Schveighoffer wrote: it seems that the only difference between `void` and `double` lambda is one asm instruction: `fldl (%edi)`. it is presend in `double` labmda, and absent in `void` lambda. it looks like ignoring `double` result causes FPU stack imbalance ('cause compiler doesn't

Re: issue with each specifically for x86

2018-03-07 Thread ag0aep6g via Digitalmars-d-learn
On 03/07/2018 09:09 PM, ag0aep6g wrote: double f() { return 1; } void main() {     cast(void) f();     cast(void) f();     cast(void) f();     cast(void) f();     cast(void) f();     cast(void) f();     cast(void) f();     double b = 2;     assert(b == 2); /* fails; should pass

Re: issue with each specifically for x86

2018-03-07 Thread ketmar via Digitalmars-d-learn
ag0aep6g wrote: On 03/07/2018 09:09 PM, ag0aep6g wrote: double f() { return 1; } void main() {     cast(void) f();     cast(void) f();     cast(void) f();     cast(void) f();     cast(void) f();     cast(void) f();     cast(void) f();     double b = 2;     assert(b == 2); /*

Re: issue with each specifically for x86

2018-03-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/7/18 1:57 PM, Matt Gamble wrote: This is a record for me with two 32bit vs 64bit issues in one day. Seems to be a problem with using "each" under 32bit which can be fixed by using foreach or switching to x64. Am I doing something wrong or is this the second bug I've found today? Below

Re: issue with each specifically for x86

2018-03-07 Thread ag0aep6g via Digitalmars-d-learn
On 03/07/2018 08:54 PM, Steven Schveighoffer wrote: Looking at each, it looks like it does this: cast(void) unaryFun!pred(r.front); So I tried this: auto pred = i => a[i] = a[i-1] + 2; foreach(i; 1 .. a.length)    cast(void)pred(i); And I see the -nan value. Remove the cast(void) and I

issue with each specifically for x86

2018-03-07 Thread Matt Gamble via Digitalmars-d-learn
This is a record for me with two 32bit vs 64bit issues in one day. Seems to be a problem with using "each" under 32bit which can be fixed by using foreach or switching to x64. Am I doing something wrong or is this the second bug I've found today? Below is a silly case, that replicates an

Re: issue with each specifically for x86

2018-03-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/7/18 3:09 PM, ag0aep6g wrote: On 03/07/2018 08:54 PM, Steven Schveighoffer wrote: Clearly there is some codegen issue here. It's beautiful: double f() { return 1; } void main() {     cast(void) f();     cast(void) f();     cast(void) f();     cast(void) f();     cast(void)

Re: issue with each specifically for x86

2018-03-07 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Mar 07, 2018 at 10:21:42PM +0200, ketmar via Digitalmars-d-learn wrote: [...] > it looks like ignoring `double` result causes FPU stack imbalance > ('cause compiler doesn't insert "FPU pop" instruction), and that > affects the computations. > > on 64 bit it doesn't matter, 'cause no FPU

Re: issue with each specifically for x86

2018-03-07 Thread ketmar via Digitalmars-d-learn
H. S. Teoh wrote: On Wed, Mar 07, 2018 at 10:21:42PM +0200, ketmar via Digitalmars-d-learn wrote: [...] it looks like ignoring `double` result causes FPU stack imbalance ('cause compiler doesn't insert "FPU pop" instruction), and that affects the computations. on 64 bit it doesn't matter,

Re: issue with each specifically for x86

2018-03-07 Thread ketmar via Digitalmars-d-learn
H. S. Teoh wrote: On Wed, Mar 07, 2018 at 10:21:42PM +0200, ketmar via Digitalmars-d-learn wrote: [...] it looks like ignoring `double` result causes FPU stack imbalance ('cause compiler doesn't insert "FPU pop" instruction), and that affects the computations. on 64 bit it doesn't matter,

VsCode tutorial

2018-03-07 Thread Apocalypto via Digitalmars-d-learn
Are there any tutorials about D in vscode? Which are the minimal plugins to install to have code completion, syntax highlighting and code formatting? Are there any app templates that i can invoke to not start every project from scratch? How can I debug my app?

Re: issue with each specifically for x86

2018-03-07 Thread Matt Gamble via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 21:39:58 UTC, ketmar wrote: Matt Gamble wrote: On Wednesday, 7 March 2018 at 21:02:30 UTC, ag0aep6g wrote: On 03/07/2018 09:09 PM, ag0aep6g wrote: [...] With `real` instead of `double` x86_64 is also affected. Wow. Good to know I'm not crazy. I was afk for a

Re: issue with each specifically for x86

2018-03-07 Thread ketmar via Digitalmars-d-learn
Matt Gamble wrote: Ok, this has been submitted as a bug. https://issues.dlang.org/show_bug.cgi?id=18573 thank you.

Re: issue with each specifically for x86

2018-03-07 Thread Matt Gamble via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 21:02:30 UTC, ag0aep6g wrote: On 03/07/2018 09:09 PM, ag0aep6g wrote: double f() { return 1; } void main() {     cast(void) f();     cast(void) f();     cast(void) f();     cast(void) f();     cast(void) f();     cast(void) f();     cast(void) f();   

Re: issue with each specifically for x86

2018-03-07 Thread ketmar via Digitalmars-d-learn
Matt Gamble wrote: On Wednesday, 7 March 2018 at 21:02:30 UTC, ag0aep6g wrote: On 03/07/2018 09:09 PM, ag0aep6g wrote: double f() { return 1; } void main() {     cast(void) f();     cast(void) f();     cast(void) f();     cast(void) f();     cast(void) f();     cast(void) f();    

Re: Can't "is null" an interface?!?! Incompatible types???

2018-03-07 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 8 March 2018 at 04:48:08 UTC, Nick Sabalausky (Abscissa) wrote: - import vibe.core.net; TCPConnection mySocket; void main() { auto b = mySocket is null; } - That's giving me: - Error: incompatible types for

Re: VsCode tutorial

2018-03-07 Thread Mike Franklin via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 21:39:09 UTC, Apocalypto wrote: Are there any tutorials about D in vscode? No that I know of. Which are the minimal plugins to install to have code completion, syntax highlighting and code formatting? I've been getting by with

Re: docs/definition: !object

2018-03-07 Thread ketmar via Digitalmars-d-learn
Nick Sabalausky (Abscissa) wrote: (Or does return the address of the *reference* to the object rather than the address of the object?...You can see just how often I do OO in D ;) ) exactly. if you want to convert object to a pointer safely, do this: MyObject o; void* p =

docs/definition: !object

2018-03-07 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
I'm having trouble finding the documentation for what exactly the unary "not" operator does when applied to a class/interface object. Does this documentation exist somewhere? I know at least part of it involves "is null", but I seem to remember hearing there was more to it than just that.

Re: docs/definition: !object

2018-03-07 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 03/08/2018 12:05 AM, ketmar wrote: Nick Sabalausky (Abscissa) wrote: I'm having trouble finding the documentation for what exactly the unary "not" operator does when applied to a class/interface object. Does this documentation exist somewhere? I know at least part of it involves "is

Can't "is null" an interface?!?! Incompatible types???

2018-03-07 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
- import vibe.core.net; TCPConnection mySocket; void main() { auto b = mySocket is null; } - That's giving me: - Error: incompatible types for (mySocket) is (null): TCPConnection and typeof(null) - WTF?!?!

Re: docs/definition: !object

2018-03-07 Thread ketmar via Digitalmars-d-learn
Nick Sabalausky (Abscissa) wrote: I'm having trouble finding the documentation for what exactly the unary "not" operator does when applied to a class/interface object. Does this documentation exist somewhere? I know at least part of it involves "is null", but I seem to remember hearing

Re: issue with inf from exp function

2018-03-07 Thread Matt Gamble via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 16:40:04 UTC, Steven Schveighoffer wrote: On 3/7/18 11:19 AM, Matt Gamble wrote: On Wednesday, 7 March 2018 at 16:12:28 UTC, Matt Gamble wrote: On Wednesday, 7 March 2018 at 16:10:15 UTC, Marc wrote: On Wednesday, 7 March 2018 at 16:00:39 UTC, Alex wrote: [...]

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

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

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

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

DUB and Gtk-d reduce size of huge executable, build dynamic dependencies

2018-03-07 Thread CSim via Digitalmars-d-learn
Hi, I'm trying to decide whether it is better to use DLang for Gtk development or Vala/Genie. When I make a simple Vala/Genie Gtk executable the file is tiny whereas the DLang file is huge. First I used the default Dub build and the file was in excess of 60mb (assuming this includes debug

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

Re: Generic test bit function (core.bitop)

2018-03-07 Thread Alex via Digitalmars-d-learn
On Tuesday, 6 March 2018 at 10:37:30 UTC, Pierre wrote: Hi all, I would like to use bt function (core.bitop) on generic array but it seems that's not possible. I would like to know if there is some reasons to have a fixed type (size_t) instead of something like : pure @system int bt(T)(in

How can I get notified when an process created by spawnShell() has exit?

2018-03-07 Thread Marc via Digitalmars-d-learn
I do need to start (up to 4 a time) processes in parallel but I'd like to get notified (similar to C#'s Process.Exited Event) when the process exits. How can I do that in D?

issue with inf from exp function

2018-03-07 Thread Matt Gamble via Digitalmars-d-learn
I don't understand why I'm getting an 'inf' by raising E to a real number, e^^710.0L. See below. import std.stdio; import std.math; unittest { writefln("ln(largest double) = %s", log(double.max)); // 709.783 writefln("e^710 = %s", exp(710.0));// inf, makes sense

Re: issue with inf from exp function

2018-03-07 Thread Matt Gamble via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 16:00:39 UTC, Alex wrote: On Wednesday, 7 March 2018 at 15:44:28 UTC, Matt Gamble wrote: I don't understand why I'm getting an 'inf' by raising E to a real number, e^^710.0L. See below. import std.stdio; import std.math; unittest { writefln("ln(largest double)

Re: issue with inf from exp function

2018-03-07 Thread Marc via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 16:06:26 UTC, Matt Gamble wrote: On Wednesday, 7 March 2018 at 16:00:39 UTC, Alex wrote: On Wednesday, 7 March 2018 at 15:44:28 UTC, Matt Gamble wrote: [...] works for me as expected. ln(largest double) = 709.783 e^710 = inf ln(largest real) = 11356.5 e^710 =

Re: issue with inf from exp function

2018-03-07 Thread Matt Gamble via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 16:10:15 UTC, Marc wrote: On Wednesday, 7 March 2018 at 16:00:39 UTC, Alex wrote: On Wednesday, 7 March 2018 at 15:44:28 UTC, Matt Gamble wrote: [...] works for me as expected. ln(largest double) = 709.783 e^710 = inf ln(largest real) = 11356.5 e^710 =

Re: issue with inf from exp function

2018-03-07 Thread Marc via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 16:00:39 UTC, Alex wrote: On Wednesday, 7 March 2018 at 15:44:28 UTC, Matt Gamble wrote: I don't understand why I'm getting an 'inf' by raising E to a real number, e^^710.0L. See below. import std.stdio; import std.math; unittest { writefln("ln(largest double)

Re: issue with inf from exp function

2018-03-07 Thread Matt Gamble via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 16:12:28 UTC, Matt Gamble wrote: On Wednesday, 7 March 2018 at 16:10:15 UTC, Marc wrote: On Wednesday, 7 March 2018 at 16:00:39 UTC, Alex wrote: On Wednesday, 7 March 2018 at 15:44:28 UTC, Matt Gamble wrote: [...] works for me as expected. ln(largest double) =

Re: issue with inf from exp function

2018-03-07 Thread Marc via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 16:12:28 UTC, Matt Gamble wrote: On Wednesday, 7 March 2018 at 16:10:15 UTC, Marc wrote: On Wednesday, 7 March 2018 at 16:00:39 UTC, Alex wrote: On Wednesday, 7 March 2018 at 15:44:28 UTC, Matt Gamble wrote: [...] works for me as expected. ln(largest double) =

Re: issue with inf from exp function

2018-03-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/7/18 11:19 AM, Matt Gamble wrote: On Wednesday, 7 March 2018 at 16:12:28 UTC, Matt Gamble wrote: On Wednesday, 7 March 2018 at 16:10:15 UTC, Marc wrote: On Wednesday, 7 March 2018 at 16:00:39 UTC, Alex wrote: On Wednesday, 7 March 2018 at 15:44:28 UTC, Matt Gamble wrote: [...] works

Re: issue with inf from exp function

2018-03-07 Thread Alex via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 15:44:28 UTC, Matt Gamble wrote: I don't understand why I'm getting an 'inf' by raising E to a real number, e^^710.0L. See below. import std.stdio; import std.math; unittest { writefln("ln(largest double) = %s", log(double.max)); // 709.783