log for complex

2018-03-06 Thread J-S Caux via Digitalmars-d-learn
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!double) Some basic functions are described in

Re: can't build libuid examples

2018-03-06 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 6 March 2018 at 19:19:05 UTC, greatsam4sure wrote: Try to build libuid examples get the following error. dub build, build successfully on the root folder. I will appreciate any help. Just try to build a gui app using dlang. OPTLINK (R) for Win32 Release 8.00.17 Those

Setting executable's information by resources

2018-03-06 Thread Marc via Digitalmars-d-learn
I'm trying to use this resource to set executable's information/metadata but it fail to set anything but the icon, without any error message. Could anyone point out if there's anything wrong with my approach? (if anyone use a different approach/toolset to set those data, your suggestion is

Re: Profiling after exit()

2018-03-06 Thread Martin Nowak via Digitalmars-d-learn
On Thursday, 27 July 2017 at 15:16:35 UTC, Eugene Wissner wrote: Are there profilers that work well with dmd? valgrind? OProfile? Yes, any sampling profiler works fine, e.g. perf on linux, Intel VTune/AMD CodeXL on Windows. Those directly monitor CPU performance counters and have a

Re: How to use globals correctly?

2018-03-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, March 06, 2018 11:52:05 H. S. Teoh via Digitalmars-d-learn wrote: > On Tue, Mar 06, 2018 at 11:46:04AM -0700, Jonathan M Davis via Digitalmars-d-learn wrote: > > On Tuesday, March 06, 2018 18:34:34 bauss via Digitalmars-d-learn wrote: > [...] > > > > Singletons are always smelly code

Re: See docs compiler message

2018-03-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/6/18 9:50 AM, ixid wrote: On Tuesday, 6 March 2018 at 14:37:27 UTC, Steven Schveighoffer wrote: Now, there aren't actually docs for Transposed, but you can find it if you look at std.range.transposed: https://dlang.org/phobos/std_range.html#transposed Thanks, I had found that but that

Re: How to use globals correctly?

2018-03-06 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Mar 06, 2018 at 11:46:04AM -0700, Jonathan M Davis via Digitalmars-d-learn wrote: > On Tuesday, March 06, 2018 18:34:34 bauss via Digitalmars-d-learn wrote: [...] > > Singletons are always smelly code tbh. > > > > Especially in D with thread-local storage. > > > > I can't think of a

Re: Speed of math function atan: comparison D and C++

2018-03-06 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 6 March 2018 at 18:41:15 UTC, H. S. Teoh wrote: The fix itself may be straightforward, but how to do it without breaking tons of existing code and provoking user backlash is the tricky part. [snip] Ah, I see what you're saying. People may be depending on the extra accuracy for

can't build libuid examples

2018-03-06 Thread greatsam4sure via Digitalmars-d-learn
Try to build libuid examples get the following error. dub build, build successfully on the root folder. I will appreciate any help. Just try to build a gui app using dlang. OPTLINK (R) for Win32 Release 8.00.17 Copyright (C) Digital Mars 1989-2013 All rights reserved.

Re: How to use globals correctly?

2018-03-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, March 06, 2018 18:34:34 bauss via Digitalmars-d-learn wrote: > On Monday, 5 March 2018 at 19:51:33 UTC, Steven Schveighoffer > > wrote: > > On 3/5/18 2:25 PM, Marc wrote: > >> Can __gshared be used instead of static in the singleton > >> pattern? I, comming from C++, ignorantly, have

Re: Speed of math function atan: comparison D and C++

2018-03-06 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Mar 06, 2018 at 06:05:59PM +, jmh530 via Digitalmars-d-learn wrote: > On Tuesday, 6 March 2018 at 17:51:54 UTC, H. S. Teoh wrote: > > [snip] > > > > I'm not advocating for getting *rid* of 80-bit float support, but > > only to make it *optional* rather than the default, as currently >

Re: How to use globals correctly?

2018-03-06 Thread bauss via Digitalmars-d-learn
On Monday, 5 March 2018 at 19:51:33 UTC, Steven Schveighoffer wrote: On 3/5/18 2:25 PM, Marc wrote: Can __gshared be used instead of static in the singleton pattern? I, comming from C++, ignorantly, have never used _gshared so I went to static instead of (being static also means

Re: Speed of math function atan: comparison D and C++

2018-03-06 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 6 March 2018 at 17:51:54 UTC, H. S. Teoh wrote: [snip] I'm not advocating for getting *rid* of 80-bit float support, but only to make it *optional* rather than the default, as currently done in std.math. T Aren't there two issues: 1) std.math functions that cast to real to

Re: What's the proper way to add a local file dependence to dub?

2018-03-06 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-03-04 17:46, Marc wrote: then copy it to sources folder? let's say I have a small library folder at C:\mylibrary\D where I want to use dir.d from it. How do I add that file dependence to dub? But I do not want to that file be passed directly to dmd, I want to that file be copied to

Re: Is it possible to return the subclass from a method of the parent class in dlang?

2018-03-06 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-03-02 21:23, Christian Köstlin wrote: To give an example: class Thread { ... Thread start() {...} } class Timer : Thread { ... } void main() { // Timer timer = new Timer().start; // this does not work auto timer = new Timer().start; // because timer is of type Thread

Re: Speed of math function atan: comparison D and C++

2018-03-06 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Mar 06, 2018 at 08:12:57AM +0100, Robert M. Münch via Digitalmars-d-learn wrote: > On 2018-03-05 20:11:06 +, H. S. Teoh said: > > > Walter has been adamant that we should always compute std.math.* > > functions with the `real` type, which on x86 maps to the non-IEEE > > 80-bit

Re: See docs compiler message

2018-03-06 Thread ixid via Digitalmars-d-learn
On Tuesday, 6 March 2018 at 14:50:05 UTC, ixid wrote: On Tuesday, 6 March 2018 at 14:37:27 UTC, Steven Schveighoffer wrote: Now, there aren't actually docs for Transposed, but you can find it if you look at std.range.transposed: https://dlang.org/phobos/std_range.html#transposed -Steve

dub preBuildCommand not working

2018-03-06 Thread Marc via Digitalmars-d-learn
I added the followiing to my dub.json: "preBuildCommand": [ "C:\\Users\\user003\\Desktop\\Nova pasta\\a.exe", "C:\\dm\\bin\\rcc.exe -32 -D__NT__ res.rc -o sources\\res.res" ] But neither command is executed. "C:\\Users\\user003\\Desktop\\Nova

Re: See docs compiler message

2018-03-06 Thread ixid via Digitalmars-d-learn
On Tuesday, 6 March 2018 at 14:37:27 UTC, Steven Schveighoffer wrote: Now, there aren't actually docs for Transposed, but you can find it if you look at std.range.transposed: https://dlang.org/phobos/std_range.html#transposed -Steve Thanks, I had found that but that is not an explanation

Re: See docs compiler message

2018-03-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/6/18 9:28 AM, ixid wrote: /opt/compilers/dmd2/include/std/algorithm/iteration.d(663): Deprecation: function `std.range.Transposed!(string[], cast(TransverseOptions)0).Transposed.save` is deprecated - This function is incorrect and will be removed November 2018. See the docs for more

Re: See docs compiler message

2018-03-06 Thread Uknown via Digitalmars-d-learn
On Tuesday, 6 March 2018 at 14:28:52 UTC, ixid wrote: /opt/compilers/dmd2/include/std/algorithm/iteration.d(663): Deprecation: function `std.range.Transposed!(string[], cast(TransverseOptions)0).Transposed.save` is deprecated - This function is incorrect and will be removed November 2018. See

See docs compiler message

2018-03-06 Thread ixid via Digitalmars-d-learn
/opt/compilers/dmd2/include/std/algorithm/iteration.d(663): Deprecation: function `std.range.Transposed!(string[], cast(TransverseOptions)0).Transposed.save` is deprecated - This function is incorrect and will be removed November 2018. See the docs for more details. If it's going to say 'See

Re: Validity of cast(void*)size_t.max

2018-03-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/6/18 1:08 AM, Kagamin wrote: On Monday, 5 March 2018 at 18:28:43 UTC, Steven Schveighoffer wrote: Note, I think the error is bogus, you should be able to create hard-coded addresses of data at compile time -- I'm not sure how you would do hardware registers otherwise. I'd do them as

Generic test bit function (core.bitop)

2018-03-06 Thread Pierre via Digitalmars-d-learn
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 T* p,size_t bitnum) if(__traits(isIntegral,T)) {

Re: Thread Function does not executes

2018-03-06 Thread Vino via Digitalmars-d-learn
On Monday, 5 March 2018 at 13:50:28 UTC, Vino wrote: Hi All, Request your help, I have 3 functions such as below, I am calling these function using another function ptManage which executes these function's in parallel as each of the below 3 function run's on 10 - 12 different file systems,

Re: Speed of math function atan: comparison D and C++

2018-03-06 Thread Uknown via Digitalmars-d-learn
On Tuesday, 6 March 2018 at 08:20:05 UTC, J-S Caux wrote: On Tuesday, 6 March 2018 at 07:12:57 UTC, Robert M. Münch wrote: On 2018-03-05 20:11:06 +, H. S. Teoh said: [snip] Now, with Uknown's trick of using the C math functions, I can reconsider. It's a bit of a "patch" but at least it

Re: Speed of math function atan: comparison D and C++

2018-03-06 Thread J-S Caux via Digitalmars-d-learn
On Tuesday, 6 March 2018 at 07:12:57 UTC, Robert M. Münch wrote: On 2018-03-05 20:11:06 +, H. S. Teoh said: Walter has been adamant that we should always compute std.math.* functions with the `real` type, which on x86 maps to the non-IEEE 80-bit floats. However, 80-bit floats have been

Re: Speed of math function atan: comparison D and C++

2018-03-06 Thread Andrea Fontana via Digitalmars-d-learn
On Monday, 5 March 2018 at 20:11:06 UTC, H. S. Teoh wrote: Walter has been adamant that we should always compute std.math.* functions with the `real` type T I don't understand why atan(float) returns real and atan(double) return real too. If I'm working with float, why does it return a