Talk:Roots of a quadratic function: Difference between revisions
(→C examples: stupidity, not vandalism...) |
m (noted difference between -1e6 and -10**6.) |
||
Line 8: | Line 8: | ||
Basically all the test cases had a = 1, :-) So I added some test cases especially where a ≠ 1, hence 2*a ≠ 2/a.... [[User:NevilleDNZ|NevilleDNZ]] 14:28, 16 September 2010 (UTC) |
Basically all the test cases had a = 1, :-) So I added some test cases especially where a ≠ 1, hence 2*a ≠ 2/a.... [[User:NevilleDNZ|NevilleDNZ]] 14:28, 16 September 2010 (UTC) |
||
In the example above (2nd line) (-10<sup>6</sup>) isn't the same as -1e6. The former is -1,000,000 and the latter is +1,000,000. --[[User:Gerard Schildberger|Gerard Schildberger]] 18:11, 25 June 2011 (UTC) |
|||
== J example == |
== J example == |
Revision as of 18:11, 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)
In the example above (2nd line) (-106) isn't the same as -1e6. The former is -1,000,000 and the latter is +1,000,000. --Gerard Schildberger 18:11, 25 June 2011 (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)
Wait, what? The existing C and C++ code gives 10^20 and 10^-20 as roots to equation
x^2 - 10^-20 x + 1 == 0
? What the? --Ledrug 09:22, 25 June 2011 (UTC)
Eh never mind that, and sorry about making a mess on the incorrect tags--I need sleep... --Ledrug 09:40, 25 June 2011 (UTC)