Files
fs2open.github.com/code
Peter Mitsis 83d00839ed fvi: Refactor solution to quadratic formula
The classic solution to the quadratic equation ...
     a*x*x + b*x + c = 0
is ...
         -b +- sqrt(b*b - 4*ac)
     x = ----------------------
                 2*a

This can be optimized by substituting b = 2*B.
         -2*B +- sqrt((2*B)*(2*B) - 4*a*c)
     x = ---------------------------------
                       2*a

This expands to ...
         -2*B +- sqrt(4*B*B - 4*a*c)
     x = ---------------------------
                    2*a

And simplifies to ...
         -2*B +- 2*sqrt(B*B - 4*a*c)
     x = ---------------------------
                    2*a

         -B +- sqrt(B*B - a*c)
     x = ---------------------
                  a

Signed-off-by: Peter Mitsis <[email protected]>
2015-07-15 09:18:47 -04:00
..
2015-04-24 15:03:59 +02:00
2015-04-29 23:21:49 -07:00
2013-09-26 18:51:33 +10:00
2010-05-29 15:53:18 +00:00
2015-05-29 16:31:41 +02:00
2013-09-26 18:51:33 +10:00
2015-04-28 19:36:30 +10:00
2005-07-13 03:26:00 +00:00
2013-09-26 18:51:33 +10:00
2013-09-26 18:51:33 +10:00
2014-10-15 18:22:57 +10:00
2015-06-13 13:16:56 -04:00
2013-09-26 18:51:33 +10:00