Talk:Roots of a quadratic function: Difference between revisions
("I wonder why noone spotted this earlier!" => Basically all the test cases had a = 1. :-)) |
(→C examples: new section) |
||
Line 11: | Line 11: | ||
== J example == |
== J example == |
||
Dumontier, hope you don't mind me replacing your example code. I understood that you were trying to illustrate the generality of <code>p.</code> however your example used a quadratic, that had already been shown above. If you were trying to illustrate some other point I apologise! --[[User:Tikkanz|Tikkanz]] 23:14, 14 October 2009 (UTC) |
Dumontier, hope you don't mind me replacing your example code. I understood that you were trying to illustrate the generality of <code>p.</code> however your example used a quadratic, that had already been shown above. If you were trying to illustrate some other point I apologise! --[[User:Tikkanz|Tikkanz]] 23:14, 14 October 2009 (UTC) |
||
== C examples == |
|||
I just provided a (more) correct C version, and am now tempted to remove other C examples, because the task specifically mentioned the shortcoming of the naive method, yet they went on that route anyway. Opinions? --[[User:Ledrug|Ledrug]] 09:08, 25 June 2011 (UTC) |
Revision as of 09:08, 25 June 2011
I clearly see come of programs (Ada, and some marked as "translation of Ada") use (b^2-4ac)/2*a, there correct way is (b^2-4ac)/(2*a). I wonder why noone spotted this earlier!
Forsythe, Michael Malcolm and Cleve Mole suggest to try it on a=1, b=-105, c=1, but Ada sample code uses -10e5, which is indeed -1e6 (-106), if I was not wrong since I knew the "e" notation... --ShinTakezou 21:24, 22 June 2009 (UTC)
Basically all the test cases had a = 1, :-) So I added some test cases especially where a ≠ 1, hence 2*a ≠ 2/a.... NevilleDNZ 14:28, 16 September 2010 (UTC)
J example
Dumontier, hope you don't mind me replacing your example code. I understood that you were trying to illustrate the generality of p.
however your example used a quadratic, that had already been shown above. If you were trying to illustrate some other point I apologise! --Tikkanz 23:14, 14 October 2009 (UTC)
C examples
I just provided a (more) correct C version, and am now tempted to remove other C examples, because the task specifically mentioned the shortcoming of the naive method, yet they went on that route anyway. Opinions? --Ledrug 09:08, 25 June 2011 (UTC)