From the book "real computing made real" by Acton, the suggestion is to first view (not always!) the quadratic as x^2 + 2bx + c, so its roots are -b +/- sqrt(b^2 - c). The product of the roots is c and therefore we can compute the root that…
……离散化带来的非物理人工痕迹会彻底毁掉你的计算。取决于你的处理方式,舍入误差可能会改善也可能会恶化,福尔曼·阿克顿(Foreman Acton)的《Numerical Methods that Work》以及后来的《Real Computing Made Real》揭示了控制这些误差的技巧,能让你用 float 完成很多事情,而且有人会指出,直接换成 double 其实并不能给你留出多少犯错的余地。
…unphysical artifacts of the discretization would wreck your calculation. Depending on how you did things rounding errors can be made better or worse, Foreman Action's Numerical Methods that Work and later Real Computing Made Real reveal techniques for managing these errors that let you accomplish a lot with floats and some would point out that going to doubles doesn't win you that much slack to do things wrong.
根据阿克顿(Acton)在《Real Computing Made Real》一书中的建议,最好先将二次方程(并不总是如此!)看作 x^2 + 2bx + c,这样它的根就是 -b +/- sqrt(b^2 - c)。两根之积为 c,因此我们可以算出那个……
From the book "real computing made real" by Acton, the suggestion is to first view (not always!) the quadratic as x^2 + 2bx + c, so its roots are -b +/- sqrt(b^2 - c). The product of the roots is c and therefore we can compute the root that…
……离散化带来的非物理人工痕迹会彻底毁掉你的计算。取决于你的处理方式,舍入误差可能会改善也可能会恶化,福尔曼·阿克顿(Foreman Acton)的《Numerical Methods that Work》以及后来的《Real Computing Made Real》揭示了控制这些误差的技巧,能让你用 float 完成很多事情,而且有人会指出,直接换成 double 其实并不能给你留出多少犯错的余地。
…unphysical artifacts of the discretization would wreck your calculation. Depending on how you did things rounding errors can be made better or worse, Foreman Action's Numerical Methods that Work and later Real Computing Made Real reveal techniques for managing these errors that let you accomplish a lot with floats and some would point out that going to doubles doesn't win you that much slack to do things wrong.