digitalmars.D.bugs - Bug Of pow in std.math
- sins666 (5/5) Jun 30 2010 I found a Bug.The bug lives in function of pow in std.math.
- Simen kjaeraas (8/13) Jun 30 2010 I would recommend discussing such in digitalmars.D.learn.
- sins666 (11/24) Jun 30 2010 import std.math;
- Simen kjaeraas (9/19) Jul 01 2010 The mistake is in your code. std.math.pow has a version that takes
- sins666 (6/25) Jul 01 2010 takes
I found a Bug.The bug lives in function of pow in std.math. When wake up the bug that, we select value of minus to second argument of pow. And happen the <<object.Error: Integer Divide by Zero>> error. I think that is a Bug. Is it?
Jun 30 2010
sins666 <d-bugmail puremagic.com> wrote:I found a Bug.The bug lives in function of pow in std.math. When wake up the bug that, we select value of minus to second argument of pow. And happen the <<object.Error: Integer Divide by Zero>> error. I think that is a Bug. Is it?I would recommend discussing such in digitalmars.D.learn. Now, I'm not able to recreate this. Am I right to understand it to be: std.math.pow( 5, -3 ); ? If not, would you please post code that triggers the bug? -- Simen
Jun 30 2010
== Quote from Simen kjaeraas (simen.kjaras gmail.com)'s articlesins666 <d-bugmail puremagic.com> wrote:import std.math; import std.stdio; void main() { writeln(pow(5, 2)); // 25 writeln(pow(5, 0)); // 1 writeln(pow(5, -3)); // object.Error: Integer Divide by Zero } And dmd version is 2.047. Was I mistake in my source.or bug?I found a Bug.The bug lives in function of pow in std.math. When wake up the bug that, we select value of minus to second argument of pow. And happen the <<object.Error: Integer Divide by Zero>> error. I think that is a Bug. Is it?I would recommend discussing such in digitalmars.D.learn. Now, I'm not able to recreate this. Am I right to understand it to be: std.math.pow( 5, -3 ); ? If not, would you please post code that triggers the bug?
Jun 30 2010
sins666 <d-bugmail puremagic.com> wrote:import std.math; import std.stdio; void main() { writeln(pow(5, 2)); // 25 writeln(pow(5, 0)); // 1 writeln(pow(5, -3)); // object.Error: Integer Divide by Zero } And dmd version is 2.047. Was I mistake in my source.or bug?The mistake is in your code. std.math.pow has a version that takes only integers, and returns only integers. That is the version you are using. If instead you try: writeln(pow(5.0, -3.0)); You should see improvement. -- Simen
Jul 01 2010
== Quote from Simen kjaeraas (simen.kjaras gmail.com)'s articlesins666 <d-bugmail puremagic.com> wrote:Zeroimport std.math; import std.stdio; void main() { writeln(pow(5, 2)); // 25 writeln(pow(5, 0)); // 1 writeln(pow(5, -3)); // object.Error: Integer Divide bytakes} And dmd version is 2.047. Was I mistake in my source.or bug?The mistake is in your code. std.math.pow has a version thatonly integers, and returns only integers. That is the version you are using. If instead you try: writeln(pow(5.0, -3.0)); You should see improvement.Oh, I see. Thank you for your response and advice. even so, why is that "object.Error: Integer Divide by Zero"...
Jul 01 2010