Re: A floating-point puzzle

2009-08-05 Thread Jarrett Billingsley
On Wed, Aug 5, 2009 at 10:16 PM, Don wrote: > Lars T. Kyllingstad wrote: >> >> Lars T. Kyllingstad wrote: >>> >>> Here's a puzzle for you floating-point wizards out there. I have to >>> translate the following snippet of FORTRAN code to D: >>> >>>      REAL B,Q,T >>> C     -

Re: A floating-point puzzle

2009-08-05 Thread Don
Lars T. Kyllingstad wrote: Lars T. Kyllingstad wrote: Here's a puzzle for you floating-point wizards out there. I have to translate the following snippet of FORTRAN code to D: REAL B,Q,T C -- C |*** COMPUTE MACHINE BASE ***| C -

Re: alias syntax

2009-08-05 Thread Ellery Newcomer
> -- > As to your question: > class K{ > alias static int B; > B b; // b is non-static > } > -- > Curious. I didn't actually test the example, but I did for deprecated, and it doesn

Re: Shared Object with DMD v2.031

2009-08-05 Thread Sergey Gromov
Wed, 5 Aug 2009 20:46:53 + (UTC), teo wrote: > On Tue, 04 Aug 2009 18:41:50 +0400, Sergey Gromov wrote: > >> Sun, 2 Aug 2009 11:18:24 + (UTC), teo wrote: >> >>> On Sun, 02 Aug 2009 02:18:28 +0400, Sergey Gromov wrote: >>> My guess is that test.di is exactly the same as test.d becau

Re: At compile time

2009-08-05 Thread Sergey Gromov
Tue, 04 Aug 2009 19:57:19 -0400, bearophile wrote: > D2 is now able to execute math functions (sin, cos, sqrt, etc) at compile > time. > > [snip] > > But similar D2 program produces, with DMD v.2.031: > test.d(12): Error: non-constant expression (V3(1,2,3)).norm() > > // D2 code > import std.m

Re: Shared Object with DMD v2.031

2009-08-05 Thread teo
On Tue, 04 Aug 2009 18:41:50 +0400, Sergey Gromov wrote: > Sun, 2 Aug 2009 11:18:24 + (UTC), teo wrote: > >> On Sun, 02 Aug 2009 02:18:28 +0400, Sergey Gromov wrote: >> >>> My guess is that test.di is exactly the same as test.d because all the >>> functions are small. Therefore compiling 'd

[OT] Re: At compile time

2009-08-05 Thread BCS
Reply to bearophile, Jarrett Billingsley: [...] -- Lars T. Kyllingstad: Replying to two different post in the same post significantly reduces the changes that the second poster will see your reply.

Re: At compile time

2009-08-05 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 bearophile wrote: > D2 is now able to execute math functions (sin, cos, sqrt, etc) at compile > time. > > This little C++ program compiles correctly with G++: > > // C++ code > #include > #include > > struct V3 { > double x, y, z; > V3(c

Re: A floating-point puzzle

2009-08-05 Thread Jouko Koski
"Lars T. Kyllingstad" wrote: After the above code has finished, the variable B contains the radix of the computer's numerical system. I guess I can just drop this part from my code, then. ;) Well, there is certain likelihood that decimal floating point will reappear in the future. However

Re: A floating-point puzzle

2009-08-05 Thread Bill Baxter
On Wed, Aug 5, 2009 at 8:07 AM, Lars T. Kyllingstad wrote: > Lars T. Kyllingstad wrote: >> >> Here's a puzzle for you floating-point wizards out there. I have to >> translate the following snippet of FORTRAN code to D: >> >>      REAL B,Q,T >> C     -- >> C     |*** COMP

Re: A floating-point puzzle

2009-08-05 Thread Lars T. Kyllingstad
Lars T. Kyllingstad wrote: Here's a puzzle for you floating-point wizards out there. I have to translate the following snippet of FORTRAN code to D: REAL B,Q,T C -- C |*** COMPUTE MACHINE BASE ***| C -- T = 1. 10

Re: Semantics of range::put

2009-08-05 Thread Jarrett Billingsley
On Wed, Aug 5, 2009 at 3:45 AM, Oliver Kanai wrote: > Hello, > according to my understanding of the "put" method for ranges, which is part > of the output-range interface, the following should work : > > private string[] m_arrHalloStrings = ["Hallo", "Du", "Da", "wie", "?"]; > m_arrHalloStrings.pu

Re: At compile time

2009-08-05 Thread Jarrett Billingsley
*On Wed, Aug 5, 2009 at 7:23 AM, Ary Borenszweig wrote: > bearophile escribió: >> >> Jarrett Billingsley: >>> >>> C++ has static initialization that occurs before main() too.  It's just.. >>> hidden.< >> >> I see. I have to learn more about C++. Thank you. >> >> -- >> Lars T. Kyllin

Re: A floating-point puzzle

2009-08-05 Thread bearophile
Lars T. Kyllingstad: > (I am especially puzzled by the line after l.20. How can this test ever > be true? Is the fact that the 1 in l.20 is an integer literal significant?) Generally double.inf+1 == double.inf Inspecting the run time values inside a direct translation may give you clues. Bye, be

Re: Semantics of range::put

2009-08-05 Thread Oliver Kanai
I found out that an "appender" or operator ~= will work, but still do not understand why put makes the program terminate. Oliver Kanai Wrote: > Hello, > according to my understanding of the "put" method for ranges, which is part > of the output-range interface, the following should work : > > p

Re: At compile time

2009-08-05 Thread Ary Borenszweig
bearophile escribió: Jarrett Billingsley: C++ has static initialization that occurs before main() too. It's just.. hidden.< I see. I have to learn more about C++. Thank you. -- Lars T. Kyllingstad: This is good news! The restrictions you are referring to, are they any of t

A floating-point puzzle

2009-08-05 Thread Lars T. Kyllingstad
Here's a puzzle for you floating-point wizards out there. I have to translate the following snippet of FORTRAN code to D: REAL B,Q,T C -- C |*** COMPUTE MACHINE BASE ***| C -- T = 1. 10T = T + T IF ( (1.+T)

Re: At compile time

2009-08-05 Thread bearophile
Jarrett Billingsley: >C++ has static initialization that occurs before main() too. It's just.. >hidden.< I see. I have to learn more about C++. Thank you. -- Lars T. Kyllingstad: >This is good news! The restrictions you are referring to, are they any of the >ones documented he

Re: At compile time

2009-08-05 Thread Lars T. Kyllingstad
Don wrote: Jarrett Billingsley wrote: I don't think you can call struct methods at compile-time. Kind of lame, I know. Try making norm a free function. Can the D2 compiler modified/improved to allow this? It sure would be nice. In fact the D1 compiler should support it too. BTW a few of

Re: .patch

2009-08-05 Thread Don
Dimitar Kolev wrote: BCS Wrote: Hello Dimitar, Hello I am new to D. Hello, welcome. My question is: How do you apply a .patch file? this seems to be somewhat usefull: http://docs.moodle.org/en/Development:How_to_apply_a_patch windows tools (linux will already have them): http://gnuwin

Re: At compile time

2009-08-05 Thread Don
Jarrett Billingsley wrote: I don't think you can call struct methods at compile-time. Kind of lame, I know. Try making norm a free function. Can the D2 compiler modified/improved to allow this? It sure would be nice. In fact the D1 compiler should support it too. BTW a few of the restrict

Re: Semantics of range::put

2009-08-05 Thread Oliver Kanai
I found out that an "appender" or operator ~= will work, but still do not understand why put makes the program terminate. Oliver Kanai Wrote: > Hello, > according to my understanding of the "put" method for ranges, which is part > of the output-range interface, the following should work : > > p

Re: alias syntax

2009-08-05 Thread Zarathustra
Ellery Newcomer Wrote: > > You mean how the compiler rejects "alias const int x;" but not "alias > > static int x;"? That is strange.. > > I want to know why > > alias static int x; > > is allowed in the first place d.grammar accepts: alias const int a; but compiler no (it is ok). d.grammar a

Semantics of range::put

2009-08-05 Thread Oliver Kanai
Hello, according to my understanding of the "put" method for ranges, which is part of the output-range interface, the following should work : private string[] m_arrHalloStrings = ["Hallo", "Du", "Da", "wie", "?"]; m_arrHalloStrings.put("Hallo"); it compiles but does not execute: the compiler giv