Re: Program run fails on Windows

2019-10-29 Thread Joel via Digitalmars-d-learn
On Wednesday, 30 October 2019 at 03:56:40 UTC, Joel wrote: I have DLangUI program that works on macOS, but only compiles Windows. It returns -1. Is there a gotcha? It doesn't ask for any DLL's. Windows 10 Pro I got programs to compile and run with bindbc-sdl, for example.

Program run fails on Windows

2019-10-29 Thread Joel via Digitalmars-d-learn
I have DLangUI program that works on macOS, but only compiles Windows. It returns -1. Is there a gotcha? It doesn't ask for any DLL's. Windows 10 Pro

Re: Read Once then reset/init value?

2019-10-29 Thread Simen Kjærås via Digitalmars-d-learn
On Tuesday, 29 October 2019 at 22:24:20 UTC, Robert M. Münch wrote: I quite often have the pattern where a value should be read just once and after this reset itself. The idea is to avoid that others read the value by accident and get an older state, instead they get an "invalid/reset" value.

Re: Eliding of slice range checking

2019-10-29 Thread Per Nordlöw via Digitalmars-d-learn
On Friday, 25 October 2019 at 21:33:26 UTC, Per Nordlöw wrote: But it requires the function to be qualified as @trusted which might hide a @system == operator. How common is it for a == operator to be unsafe? Ping.

Re: Eliding of slice range checking

2019-10-29 Thread Per Nordlöw via Digitalmars-d-learn
On Wednesday, 23 October 2019 at 13:51:19 UTC, kinke wrote: You call this messy?! cmpq%rdi, %rdx jae .LBB0_2 xorl%eax, %eax retq .LBB0_2: movq%rdi, %rax testq %rdi, %rdi je .LBB0_3 pushq %rax

Read Once then reset/init value?

2019-10-29 Thread Robert M. Münch via Digitalmars-d-learn
I quite often have the pattern where a value should be read just once and after this reset itself. The idea is to avoid that others read the value by accident and get an older state, instead they get an "invalid/reset" value. Is there a library function that can mimic such a behaviour? --

Re: Accuracy of floating point calculations

2019-10-29 Thread kinke via Digitalmars-d-learn
On Tuesday, 29 October 2019 at 16:20:21 UTC, Daniel Kozak wrote: On Tue, Oct 29, 2019 at 5:09 PM Daniel Kozak wrote: On Tue, Oct 29, 2019 at 4:45 PM Twilight via Digitalmars-d-learn wrote: > > D calculation: >mport std.stdio; import std.math : pow; import core.stdc.math; void main() {

Re: Accuracy of floating point calculations

2019-10-29 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Oct 29, 2019 at 07:10:08PM +, Twilight via Digitalmars-d-learn wrote: > On Tuesday, 29 October 2019 at 16:11:45 UTC, Daniel Kozak wrote: > > On Tue, Oct 29, 2019 at 5:09 PM Daniel Kozak wrote: > > > If you use gdc or ldc you will get same results as c++, or you can > > > use C log

Re: Accuracy of floating point calculations

2019-10-29 Thread Twilight via Digitalmars-d-learn
On Tuesday, 29 October 2019 at 16:11:45 UTC, Daniel Kozak wrote: On Tue, Oct 29, 2019 at 5:09 PM Daniel Kozak wrote: If you use gdc or ldc you will get same results as c++, or you can use C log directly: import std.stdio; import std.math : pow; import core.stdc.math; void main() {

Re: Accuracy of floating point calculations

2019-10-29 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Oct 29, 2019 at 04:54:23PM +, ixid via Digitalmars-d-learn wrote: > On Tuesday, 29 October 2019 at 16:11:45 UTC, Daniel Kozak wrote: > > On Tue, Oct 29, 2019 at 5:09 PM Daniel Kozak wrote: > > > If you use gdc or ldc you will get same results as c++, or you can > > > use C log

Re: Accuracy of floating point calculations

2019-10-29 Thread ixid via Digitalmars-d-learn
On Tuesday, 29 October 2019 at 16:11:45 UTC, Daniel Kozak wrote: On Tue, Oct 29, 2019 at 5:09 PM Daniel Kozak wrote: If you use gdc or ldc you will get same results as c++, or you can use C log directly: import std.stdio; import std.math : pow; import core.stdc.math; void main() {

Re: Accuracy of floating point calculations

2019-10-29 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 29, 2019 at 5:09 PM Daniel Kozak wrote: > > On Tue, Oct 29, 2019 at 4:45 PM Twilight via Digitalmars-d-learn > wrote: > > > > D calculation: > >mport std.stdio; import std.math : pow; import core.stdc.math; void main() { writefln("%12.3F",log(1-0.)/log(1-(1-0.6)^^20)); } >

Re: Accuracy of floating point calculations

2019-10-29 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 29, 2019 at 5:09 PM Daniel Kozak wrote: > > > If you use gdc or ldc you will get same results as c++, or you can use > C log directly: > > import std.stdio; > import std.math : pow; > import core.stdc.math; > > void main() > { >

Re: Accuracy of floating point calculations

2019-10-29 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 29, 2019 at 4:45 PM Twilight via Digitalmars-d-learn wrote: > > D calculation: > >writefln("%12.2F",log(1-0.)/log(1-(1-0.6)^^20)); > > 837675572.38 > > C++ calculation: > >cout< <<'\n'; > > 837675573.587 > > As a second data point, changing 0. to 0.75 yields >

Accuracy of floating point calculations

2019-10-29 Thread Twilight via Digitalmars-d-learn
D calculation: writefln("%12.2F",log(1-0.)/log(1-(1-0.6)^^20)); 837675572.38 C++ calculation: cout<<<'\n'; 837675573.587 As a second data point, changing 0. to 0.75 yields 126082736.96 (Dlang) vs 126082737.142 (C++). The discrepancy stood out as I was ultimately taking the

Re: Eliding of slice range checking

2019-10-29 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 23 October 2019 at 11:20:59 UTC, Per Nordlöw wrote: Does DMD/LDC avoid range-checking in slice-expressions such as the one in my array-overload of `startsWith` defined as bool startsWith(T)(scope const(T)[] haystack, scope const(T)[] needle) { if

Re: Running unittests of a module with -betterC

2019-10-29 Thread mipri via Digitalmars-d-learn
On Monday, 28 October 2019 at 08:51:02 UTC, Daniel Kozak wrote: On Mon, Oct 28, 2019 at 9:40 AM Per Nordlöw via Digitalmars-d-learn wrote: Is it possible to run the unittests of a module with -betterC like dmd -D -g -main -unittest -betterC f.d ? This currently errors as

Blog Post #83: Notebook, Part VII - All Signals

2019-10-29 Thread Ron Tarrant via Digitalmars-d-learn
This post looks at a handful of Notebook signals, how they're triggered, and what they can be used for. We also go over the keyboard shortcuts used by the GTK Notebook. You'll find it all here: https://gtkdcoding.com/2019/10/29/0083-notebook-vii-notebook-all-signals.html