3 ms·
starting from infix equation a*x^2 + b*x + c = 0 x = (-b + sqrt(b^2 + 4*a*c)) / (2*a) is obviously conceptually clearer than (setf x (/ (+ (- b)
by medo-bear 4y ago
starting from infix equation a*x^2 + b*x + c = 0
x = (-b + sqrt(b^2 + 4*a*c)) / (2*a)
is obviously conceptually clearer than
(setf x (/ (+ (- b)
(sqrt (+ (* 4 a c)
(* b b))))
(* 2 a)))
i however think the latter is computationally clearer. also i think the difference is most striking when we use well known infix formulas such as the quadratic formula. you would not have this effect with the cubic equation for example - https://en.wikipedia.org/wiki/Cubic_equation#Cardano.27s_method https://en.wikipedia.org/wiki/Cubic_equation#Cardano.27s_met...