digitalmars.D.learn - Variable below zero but if statement doesn't grab?
- TheDGuy (2/2) Dec 27 2015 Any idea what i am doing wrong?
- jkpl (3/5) Dec 27 2015 You could post the code also, personnaly I'm always almost at 2
- TheDGuy (20/25) Dec 27 2015 Sry:
- SimonN (3/5) Dec 27 2015 This looks like a bug, with & instead of &&.
- TheDGuy (17/22) Dec 27 2015 It looks like the debugger is not working correctly because i
- jkpl (2/7) Dec 28 2015 I work more or less lying on a futon. Desks are so cheesy...
- Basile B. (2/10) Dec 28 2015 Anarchism is comfy...
- jkpl (6/18) Dec 28 2015 when I'm tired with the conformism I just let my head go on the
- jkpl (5/24) Dec 28 2015 https://www.youtube.com/watch?v=g7qx5oYdOEA
- jkpl (3/29) Dec 28 2015 Also, european people should ask themselves why they stick on the
- Marcel mauss (5/24) Dec 31 2015 thumb up.
- Basile B. (5/24) Jan 05 2016 https://www.youtube.com/watch?v=YgSPaXgAdzE
- Bubbasaur (6/8) Dec 27 2015 Tell me one thing, what is the value returned?
- TheDGuy (4/12) Dec 27 2015 Okay, thanks. It actually returned the right value but it looked
- =?UTF-8?Q?Ali_=c3=87ehreli?= (6/8) Dec 27 2015 YouTube says that the video has been removed by the user. That's exactly...
Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8
Dec 27 2015
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-5VeP8You 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...
Dec 27 2015
On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote: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; }Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8You 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...
Dec 27 2015
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
Dec 27 2015
On Sunday, 27 December 2015 at 16:39:18 UTC, SimonN wrote:On Sunday, 27 December 2015 at 16:01:37 UTC, TheDGuy wrote: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.Sry: if((x1 < 0) & (x2 >= 0)){This looks like a bug, with & instead of &&. -- Simon
Dec 27 2015
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
Dec 27 2015
On Sunday, 27 December 2015 at 16:48:44 UTC, SimonN wrote:On Sunday, 27 December 2015 at 16:41:10 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)"?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
Dec 27 2015
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'");
Dec 27 2015
On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:I work more or less lying on a futon. Desks are so cheesy...Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8You 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...
Dec 28 2015
On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:Anarchism is comfy...On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:I work more or less lying on a futon. Desks are so cheesy...Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8You 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...
Dec 28 2015
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: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=2m35sOn Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:Anarchism is comfy...On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:I work more or less lying on a futon. Desks are so cheesy...Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8You 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...
Dec 28 2015
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: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.On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: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=2m35sOn Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:Anarchism is comfy...On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:I work more or less lying on a futon. Desks are so cheesy...Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8You 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...
Dec 28 2015
On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote:On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:Also, european people should ask themselves why they stick on the US culture since 60 years, while actually Russians freed Berlin.On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: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.On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: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=2m35sOn Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:Anarchism is comfy...On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:I work more or less lying on a futon. Desks are so cheesy...Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8You 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...
Dec 28 2015
On Monday, 28 December 2015 at 18:33:16 UTC, jkpl wrote:On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote:One last thing. Tough guy ? https://www.youtube.com/watch?v=1igvrZ0KosAOn Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:Also, european people should ask themselves why they stick on the US culture since 60 years, while actually Russians freed Berlin.On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: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.On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: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=2m35sOn Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:Anarchism is comfy...On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:I work more or less lying on a futon. Desks are so cheesy...Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8You 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...
Dec 28 2015
On Monday, 28 December 2015 at 19:22:00 UTC, jkpl wrote:On Monday, 28 December 2015 at 18:33:16 UTC, jkpl wrote: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...On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote:One last thing. Tough guy ? https://www.youtube.com/watch?v=1igvrZ0KosAOn Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:Also, european people should ask themselves why they stick on the US culture since 60 years, while actually Russians freed Berlin.On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: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.On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: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=2m35sOn Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:Anarchism is comfy...On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:I work more or less lying on a futon. Desks are so cheesy...Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8You 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...
Dec 28 2015
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: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.On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: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=2m35sOn Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:Anarchism is comfy...On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:I work more or less lying on a futon. Desks are so cheesy...Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8You 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...
Dec 31 2015
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: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.On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: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=2m35sOn Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:Anarchism is comfy...On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:I work more or less lying on a futon. Desks are so cheesy...Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8You 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...
Jan 05 2016
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: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.On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: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.On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: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=2m35sOn Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:Anarchism is comfy...On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:I work more or less lying on a futon. Desks are so cheesy...Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8You 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...
Jan 15 2016
On Friday, 15 January 2016 at 22:16:09 UTC, Basile B. wrote:On Tuesday, 5 January 2016 at 23:52:05 UTC, Basile B. wrote:Like the whole world can see today, you have took an anwesome decision in 1948. Well managed. very clever I'd say...On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote: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.On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: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.On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: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=2m35sOn Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:Anarchism is comfy...On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:I work more or less lying on a futon. Desks are so cheesy...Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8You 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...
Jan 15 2016
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-5VeP8Tell 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.
Dec 27 2015
On Sunday, 27 December 2015 at 18:03:16 UTC, Bubbasaur wrote:On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote: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...Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8Tell 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.
Dec 27 2015
On 12/27/2015 07:53 AM, TheDGuy wrote:Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8YouTube 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
Dec 27 2015
On Sunday, 27 December 2015 at 22:51:27 UTC, Ali Çehreli wrote:On 12/27/2015 07:53 AM, TheDGuy wrote: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.Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8YouTube 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
Dec 27 2015
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: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 :)On 12/27/2015 07:53 AM, TheDGuy wrote: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.Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8YouTube 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
Dec 28 2015
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...
Dec 28 2015