Steven Schveighoffer wrote:
A comment to explain the representation of the array may be good.
Well, I did add your explanation to the bugzilla report! Thanks.
On Fri, 14 May 2010 19:37:58 -0400, Walter Bright
wrote:
R.Tenton wrote:
At the very bottom of http://digitalmars.com/d/2.0/overview.html
there is an example implementation of the Eratosthenes' sieve.
That code is broken! It counts 1899 prime numbers, while there are only
1028
primes in t
Walter Bright wrote:
bearophile wrote:
Walter Bright:
Are you sure? What's the mistake in the code?
This is the code in the Overview, it prints 1899:
http://codepad.org/lzRtggEL
This is the code I have suggested in bugzilla, it prints 1027:
http://ideone.com/D9ZqQ
Wolfram Alpha says they
Ary Borenszweig:
> A small observation: count +=1 is performed for i = 0, hmmm...
It lacks unit tests. A basic unit testing can catch that bug.
Recently I have ready a quote: "If it has no unit tests then it's broken".
Experience shows me that this is more often true than false.
Bye,
bearophile
Walter Bright wrote:
bearophile wrote:
Walter Bright:
Are you sure? What's the mistake in the code?
This is the code in the Overview, it prints 1899:
http://codepad.org/lzRtggEL
This is the code I have suggested in bugzilla, it prints 1027:
http://ideone.com/D9ZqQ
Wolfram Alpha says they ar
bearophile wrote:
Walter Bright:
Are you sure? What's the mistake in the code?
This is the code in the Overview, it prints 1899:
http://codepad.org/lzRtggEL
This is the code I have suggested in bugzilla, it prints 1027:
http://ideone.com/D9ZqQ
Wolfram Alpha says they are 1027 (I have left ou
Walter Bright:
> Are you sure? What's the mistake in the code?
This is the code in the Overview, it prints 1899:
http://codepad.org/lzRtggEL
This is the code I have suggested in bugzilla, it prints 1027:
http://ideone.com/D9ZqQ
Wolfram Alpha says they are 1027 (I have left out the last number be
R.Tenton wrote:
At the very bottom of http://digitalmars.com/d/2.0/overview.html
there is an example implementation of the Eratosthenes' sieve.
That code is broken! It counts 1899 prime numbers, while there are only 1028
primes in the interval [1,8191]!
Are you sure? What's the mistake in the c
On 15/05/10 00:14, Pillsy wrote:
I have the following program on Mac OS X 10.6.3 running dmd version 2.043:
$ cat if.d
import std.stdio;
void main (string [] args)
{
foreach(arg; args)
writeln(arg);
auto vec = new double[10];
foreach(i, ref x; vec) { x = cast(double) i; }
if
On 15/05/10 00:14, eles wrote:
hello,
since gnu debugger (gdb) is free and now there is a version which works
properly with D, could someone host (and made available for download)
*compiled* versions for windows and linux? of course, patched versions
(so that it would work with D). maybe on dsou
hello,
since gnu debugger (gdb) is free and now there is a version which works
properly with D, could someone host (and made available for download)
*compiled* versions for windows and linux? of course, patched versions
(so that it would work with D). maybe on dsource?
thanks (I am not good when
I have the following program on Mac OS X 10.6.3 running dmd version 2.043:
$ cat if.d
import std.stdio;
void main (string [] args)
{
foreach(arg; args)
writeln(arg);
auto vec = new double[10];
foreach(i, ref x; vec) { x = cast(double) i; }
if (args.length > 1 && args[1] == "bar") {
bearophile wrote:
> kai:
>
>> I was scared off by the warning that D 2.0 support is experimental.
>
> LDC is D1 still, mostly :-(
> And at the moment it uses LLVM 2.6.
> LLVM 2.7 contains a new optimization that can improve that code some more.
>
>
>> Good to know, thanks (thats actually a grea
kai:
> I was scared off by the warning that D 2.0 support is experimental.
LDC is D1 still, mostly :-(
And at the moment it uses LLVM 2.6.
LLVM 2.7 contains a new optimization that can improve that code some more.
> Good to know, thanks (thats actually a great feature for scientists!).
In theo
== Quote from bearophile (bearophileh...@lycos.com)'s article
> But the bigger problem in your code is that you are performing operations on
NaNs (that's the default initalization of FP values in D), and operations on
NaNs
are usually quite slower.
I didn't know that. Is it the same for inf?
I us
Thanks for the help all!
> 2. Can you use vector operations? If the example you gave is
> representative of your specific problem, then you can't because you are
> adding overlapping parts of the array. But if you are doing operations
> on separate arrays, then array operations will be *much* fa
or :
module main;
//const S s = S(.5f); // Uncomment to make it compile
struct S
{
float a;
static S opCall( float a_ )
{
S s = { a_ };
return s;
}
const S _s = S( 1f );
}
void main(){}
== Quote from bearophile (bearophileh...@lycos.com)'s article
> This produces the same errors:
> struct Foo {
> int bar;
> static Foo baz() {
> return Foo();
> }
> const Foo one = Foo.baz();
> }
> void main() {}
> Bye,
> bearophile
And this is why in my program compiled any
On Thu, 13 May 2010 22:38:40 -0400, kai wrote:
Hello,
I was evaluating using D for some numerical stuff. However I was
surprised to
find that looping & array indexing was not very speedy compared to
alternatives (gcc et al). I was using the DMD2 compiler on mac and
windows,
with -O -rele
On Fri, 14 May 2010 07:32:54 -0400, Steven Schveighoffer wrote:
> On Fri, 14 May 2010 02:31:29 -0400, Lars T. Kyllingstad
> wrote:
>
>> On Fri, 14 May 2010 02:38:40 +, kai wrote:
>
>
>>> I was using the DMD2 compiler on
>>> mac and windows, with -O -release.
>>
>> 1. Have you tried the -no
On Fri, 14 May 2010 02:31:29 -0400, Lars T. Kyllingstad
wrote:
On Fri, 14 May 2010 02:38:40 +, kai wrote:
I was using the DMD2 compiler on
mac and windows, with -O -release.
1. Have you tried the -noboundscheck compiler switch? Unlike C, D checks
that you do not try to read/write b
kai:
> I was evaluating using D for some numerical stuff.
For that evaluation you probably have to use the LDC compiler, that is able to
optimize better.
> void main (string[] args)
> {
> double [] foo = new double [cast(int)1e6];
> for (int i=0;i<1e3;i+
22 matches
Mail list logo