Re: Variable below zero but if statement doesn't grab?

2016-01-15 Thread Basile B. via Digitalmars-d-learn

On Tuesday, 5 January 2016 at 23:52:05 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost 
at 2 meters from my screen, with zoom, so I can't read the 
code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on 
the pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


https://www.youtube.com/watch?v=YgSPaXgAdzE

I'm a loser baby, so why don't you leave me ?
You luv losers ? And you don't leave them ?
Nurse syndrom.


to the MI6:

It's a english daddy boy who tought me what is a papirosn

https://en.wikipedia.org/wiki/Belomorkanal

TIP to englishmen: you should learn how to behave in France.


Re: Variable below zero but if statement doesn't grab?

2016-01-05 Thread Basile B. via Digitalmars-d-learn

On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost 
at 2 meters from my screen, with zoom, so I can't read the 
code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on the 
pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


https://www.youtube.com/watch?v=YgSPaXgAdzE

I'm a loser baby, so why don't you leave me ?
You luv losers ? And you don't leave them ?
Nurse syndrom.



Re: Variable below zero but if statement doesn't grab?

2015-12-31 Thread Marcel mauss via Digitalmars-d-learn

On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost 
at 2 meters from my screen, with zoom, so I can't read the 
code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on the 
pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


thumb up.

I dont think that you have won. Monotheism is a 2000 year old 
failure.

Many god haven't solidarized us...only one failed.


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread TheDGuy via Digitalmars-d-learn
Get used to it :) Unfortunately, DMD is not emitting the best 
debug information. The program flow is correct, but the line 
info is not, that's why the execution step will not be 
triggered in the real location of the source code.


The simplest example is this:

import std.stdio;

void foo(int x)
{
if (x > 0)  //step 1, correct
{
writeln("bigger");  //step 2, correct
}
else
{
writeln("lower");   //step 3, wrong
}
}

int main(string[] argv)
{
foo(20);   //breakpoint with step in
return 0;
}

If you really want to confuse the debugger, write some asserts 
or contracts here and there and your program will be impossible 
to debug :)


So, do you have any information if there will be a fix to this? 
It is really hard (at least for me) to work with a language which 
doesn't feature a working debugger...


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Monday, 28 December 2015 at 19:22:00 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:33:16 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:
On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy 
wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always 
almost at 2 meters from my screen, with zoom, so I can't 
read the code...


I work more or less lying on a futon. Desks are so 
cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on 
the pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


https://www.youtube.com/watch?v=g7qx5oYdOEA

tous fashos: juif, chrétien, musulmans,...

Il n'y a bien que les communistes qui ont compris que les 
religions c'est de la merde.


Also, european people should ask themselves why they stick on 
the US culture since 60 years, while actually Russians freed 
Berlin.


One last thing. Tough guy ?

https://www.youtube.com/watch?v=1igvrZ0KosA


I always try to find a link to the scene, in south america:

"And finally I've done what I always done...".

I never find it. It's probably because judgment defaits us:

https://www.youtube.com/watch?v=xNRBajLM8_4

We want to show something, but we're always near, no so far, not 
close to our idea.
It exists but we cant find a reference to the perfect 
representation of the idea...




Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Monday, 28 December 2015 at 18:33:16 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost 
at 2 meters from my screen, with zoom, so I can't read the 
code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on 
the pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


https://www.youtube.com/watch?v=g7qx5oYdOEA

tous fashos: juif, chrétien, musulmans,...

Il n'y a bien que les communistes qui ont compris que les 
religions c'est de la merde.


Also, european people should ask themselves why they stick on 
the US culture since 60 years, while actually Russians freed 
Berlin.


One last thing. Tough guy ?

https://www.youtube.com/watch?v=1igvrZ0KosA


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost 
at 2 meters from my screen, with zoom, so I can't read the 
code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on 
the pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


https://www.youtube.com/watch?v=g7qx5oYdOEA

tous fashos: juif, chrétien, musulmans,...

Il n'y a bien que les communistes qui ont compris que les 
religions c'est de la merde.


Also, european people should ask themselves why they stick on the 
US culture since 60 years, while actually Russians freed Berlin.


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost 
at 2 meters from my screen, with zoom, so I can't read the 
code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on the 
pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


https://www.youtube.com/watch?v=g7qx5oYdOEA

tous fashos: juif, chrétien, musulmans,...

Il n'y a bien que les communistes qui ont compris que les 
religions c'est de la merde.


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost at 
2 meters from my screen, with zoom, so I can't read the 
code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on the 
pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread rumbu via Digitalmars-d-learn

On Sunday, 27 December 2015 at 23:24:55 UTC, TheDGuy wrote:

On Sunday, 27 December 2015 at 22:51:27 UTC, Ali Çehreli wrote:

On 12/27/2015 07:53 AM, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


YouTube says that the video has been removed by the user. 
That's exactly the reason why I don't like even dpaste. There 
is no guarantee that such threads will be useful forever. :) 
For me, sample code should be right here, and it should be 
short enough to practically be here.


Ali


I deleted the video because the problem was solved, it was 
neither a problem with the single '&' nor with my code it just 
showed a strange behaviour while debugging but the function 
returned the right value. Sample code is in my second post.


Get used to it :) Unfortunately, DMD is not emitting the best 
debug information. The program flow is correct, but the line info 
is not, that's why the execution step will not be triggered in 
the real location of the source code.


The simplest example is this:

import std.stdio;

void foo(int x)
{
if (x > 0)  //step 1, correct
{
writeln("bigger");  //step 2, correct
}
else
{
writeln("lower");   //step 3, wrong
}
}

int main(string[] argv)
{
foo(20);   //breakpoint with step in
return 0;
}

If you really want to confuse the debugger, write some asserts or 
contracts here and there and your program will be impossible to 
debug :)


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread Basile B. via Digitalmars-d-learn

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost at 
2 meters from my screen, with zoom, so I can't read the code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...




Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost at 2 
meters from my screen, with zoom, so I can't read the code...


I work more or less lying on a futon. Desks are so cheesy...


Re: Variable below zero but if statement doesn't grab?

2015-12-27 Thread TheDGuy via Digitalmars-d-learn

On Sunday, 27 December 2015 at 22:51:27 UTC, Ali Çehreli wrote:

On 12/27/2015 07:53 AM, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


YouTube says that the video has been removed by the user. 
That's exactly the reason why I don't like even dpaste. There 
is no guarantee that such threads will be useful forever. :) 
For me, sample code should be right here, and it should be 
short enough to practically be here.


Ali


I deleted the video because the problem was solved, it was 
neither a problem with the single '&' nor with my code it just 
showed a strange behaviour while debugging but the function 
returned the right value. Sample code is in my second post.


Re: Variable below zero but if statement doesn't grab?

2015-12-27 Thread Ali Çehreli via Digitalmars-d-learn

On 12/27/2015 07:53 AM, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


YouTube says that the video has been removed by the user. That's exactly 
the reason why I don't like even dpaste. There is no guarantee that such 
threads will be useful forever. :) For me, sample code should be right 
here, and it should be short enough to practically be here.


Ali



Re: Variable below zero but if statement doesn't grab?

2015-12-27 Thread TheDGuy via Digitalmars-d-learn

On Sunday, 27 December 2015 at 18:03:16 UTC, Bubbasaur wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


Tell me one thing, what is the value returned?


Well It's working here: http://dpaste.dzfl.pl/18b27ea26b08

Maybe you would like to change the code above to look like 
yours and see what happens?


Bubba.


Okay, thanks. It actually returned the right value but it looked 
like as if it would jump into the 2nd if-statement (as you can 
see on the video). Strange...


Re: Variable below zero but if statement doesn't grab?

2015-12-27 Thread Bubbasaur via Digitalmars-d-learn

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


Tell me one thing, what is the value returned?


Well It's working here: http://dpaste.dzfl.pl/18b27ea26b08

Maybe you would like to change the code above to look like yours 
and see what happens?


Bubba.


Re: Variable below zero but if statement doesn't grab?

2015-12-27 Thread SimonN via Digitalmars-d-learn

On Sunday, 27 December 2015 at 16:52:39 UTC, TheDGuy wrote:
I don't understand why my program goes into the if statement if 
the debugger shows, that the variable "discriminant" is below 
zero even though:


"if(discriminant > 0)"?


I have a hard time believing this. Does the problem persist if 
you swap out the entire control flow, beginning with that line, 
with the following?


if (discriminant > 0)
writeln("bigger than zero");
else
writeln("not entering the 'if'");


Re: Variable below zero but if statement doesn't grab?

2015-12-27 Thread TheDGuy via Digitalmars-d-learn

On Sunday, 27 December 2015 at 16:48:44 UTC, SimonN wrote:

On Sunday, 27 December 2015 at 16:41:10 UTC, TheDGuy wrote:
It looks like the debugger is not working correctly because i 
changed the code to this:

[...]
and the same problem appears.


I can't watch youtube here. What numbers does your input 
generate? Which 'if' doesn't fire? What results would you like 
instead?


-- Simon


I don't understand why my program goes into the if statement if 
the debugger shows, that the variable "discriminant" is below 
zero even though:


"if(discriminant > 0)"?


Re: Variable below zero but if statement doesn't grab?

2015-12-27 Thread SimonN via Digitalmars-d-learn

On Sunday, 27 December 2015 at 16:41:10 UTC, TheDGuy wrote:
It looks like the debugger is not working correctly because i 
changed the code to this:

[...]
and the same problem appears.


I can't watch youtube here. What numbers does your input 
generate? Which 'if' doesn't fire? What results would you like 
instead?


-- Simon


Re: Variable below zero but if statement doesn't grab?

2015-12-27 Thread TheDGuy via Digitalmars-d-learn

On Sunday, 27 December 2015 at 16:39:18 UTC, SimonN wrote:

On Sunday, 27 December 2015 at 16:01:37 UTC, TheDGuy wrote:

Sry:
if((x1 < 0) & (x2 >= 0)){


This looks like a bug, with & instead of &&.

-- Simon


It looks like the debugger is not working correctly because i 
changed the code to this:


if(discriminant > 0){
double x1 = (-b - sqrt(discriminant)) / (2.0*a);
double x2 = (-b + sqrt(discriminant)) / (2.0*a);
if((x1 >= 0) && (x2 >= 0)){
return x1;
}
if((x1 < 0) && (x2 >= 0)){
return x2;
}
return -1.0;
} else{
return -1.0;
}

and the same problem appears.


Re: Variable below zero but if statement doesn't grab?

2015-12-27 Thread SimonN via Digitalmars-d-learn

On Sunday, 27 December 2015 at 16:01:37 UTC, TheDGuy wrote:

Sry:
if((x1 < 0) & (x2 >= 0)){


This looks like a bug, with & instead of &&.

-- Simon


Re: Variable below zero but if statement doesn't grab?

2015-12-27 Thread TheDGuy via Digitalmars-d-learn

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost at 2 
meters from my screen, with zoom, so I can't read the code...


Sry:

Vector3D v = ray.origin.sub(this.center).normalize();
double a = ray.direction.dot(ray.direction);
double b = 2.0 * ray.direction.dot(v);
double c = v.dot(v) - (this.radius * this.radius);
double discriminant = (b*b) - (4.0*a*c);
if(discriminant > 0){
double x1 = (-b - sqrt(discriminant)) / (2.0*a);
double x2 = (-b + sqrt(discriminant)) / (2.0*a);
if((x1 >= 0) && (x2 >= 0)){
return x1;
}
if((x1 < 0) & (x2 >= 0)){
return x2;
}
return -1.0;
}else{
return -1.0;
}


Re: Variable below zero but if statement doesn't grab?

2015-12-27 Thread jkpl via Digitalmars-d-learn

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost at 2 
meters from my screen, with zoom, so I can't read the code...


Variable below zero but if statement doesn't grab?

2015-12-27 Thread TheDGuy via Digitalmars-d-learn

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8