Average Error: 43.5 → 2.9
Time: 12.2s
Precision: binary64
Cost: 40640
\[1.1102230246251565 \cdot 10^{-16} < a \land a < 9007199254740992 \land 1.1102230246251565 \cdot 10^{-16} < b \land b < 9007199254740992 \land 1.1102230246251565 \cdot 10^{-16} < c \land c < 9007199254740992\]
Math TeX FPCore C \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
↓
\[\left(\left(-2 \cdot \frac{\left(a \cdot a\right) \cdot {c}^{3}}{{b}^{5}} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\right) - \frac{c}{b}\right) + \frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}} \cdot -5\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} ↓
\left(\left(-2 \cdot \frac{\left(a \cdot a\right) \cdot {c}^{3}}{{b}^{5}} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\right) - \frac{c}{b}\right) + \frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}} \cdot -5 (FPCore (a b c)
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))) ↓
(FPCore (a b c)
:precision binary64
(+
(-
(-
(* -2.0 (/ (* (* a a) (pow c 3.0)) (pow b 5.0)))
(/ (* a (* c c)) (pow b 3.0)))
(/ c b))
(* (/ (* (pow a 3.0) (pow c 4.0)) (pow b 7.0)) -5.0))) double code(double a, double b, double c) {
return (-b + sqrt((b * b) - ((4.0 * a) * c))) / (2.0 * a);
}
↓
double code(double a, double b, double c) {
return (((-2.0 * (((a * a) * pow(c, 3.0)) / pow(b, 5.0))) - ((a * (c * c)) / pow(b, 3.0))) - (c / b)) + (((pow(a, 3.0) * pow(c, 4.0)) / pow(b, 7.0)) * -5.0);
}
Try it out Enter valid numbers for all inputs
Alternatives Alternative 1 Error 43.6 Cost 41408
\[\sqrt[3]{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2}} \cdot \left(\sqrt[3]{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2}} \cdot \sqrt[3]{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2}}\right)\]
Alternative 2 Error 3.2 Cost 41152
\[\frac{\left(-2 \cdot \left(\frac{a \cdot c}{b} + \frac{\left(a \cdot a\right) \cdot \left(c \cdot c\right)}{{b}^{3}}\right) + -4 \cdot \frac{{\left(a \cdot c\right)}^{3}}{{b}^{5}}\right) + -10 \cdot \frac{{c}^{4} \cdot {a}^{4}}{{b}^{7}}}{a \cdot 2}\]
Alternative 3 Error 43.6 Cost 40896
\[\frac{\sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b} \cdot \left(\sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b} \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}\right)}{a \cdot 2}\]
Alternative 4 Error 44.4 Cost 40640
\[\frac{\sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \left(\sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) - b}{a \cdot 2}\]
Alternative 5 Error 44.2 Cost 40128
\[\frac{\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} + \sqrt{b}}{\frac{a}{\frac{\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} - \sqrt{b}}{2}}}\]
Alternative 6 Error 44.2 Cost 40128
\[\frac{\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} - \sqrt{b}}{2} \cdot \frac{\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} + \sqrt{b}}{a}\]
Alternative 7 Error 44.2 Cost 40128
\[\frac{\left(\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} + \sqrt{b}\right) \cdot \left(\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} - \sqrt{b}\right)}{a \cdot 2}\]
Alternative 8 Error 3.2 Cost 35200
\[\frac{\left(-2 \cdot \left(\frac{a \cdot c}{b} + \frac{\left(a \cdot a\right) \cdot \left(c \cdot c\right)}{{b}^{3}}\right) + -4 \cdot \frac{\left(a \cdot c\right) \cdot \left(\left(a \cdot c\right) \cdot \left(a \cdot c\right)\right)}{{b}^{5}}\right) + -10 \cdot \frac{{c}^{4} \cdot {a}^{4}}{{b}^{7}}}{a \cdot 2}\]
Alternative 9 Error 3.2 Cost 34752
\[\frac{\left(-2 \cdot \left(\frac{a \cdot c}{b} + \frac{\left(a \cdot a\right) \cdot \left(c \cdot c\right)}{{b}^{3}}\right) + -4 \cdot \frac{{\left(a \cdot c\right)}^{3}}{{b}^{5}}\right) + \frac{{\left(a \cdot c\right)}^{4}}{-{b}^{7}} \cdot 10}{a \cdot 2}\]
Alternative 10 Error 3.2 Cost 34688
\[\frac{\left(-2 \cdot \left(\frac{a \cdot c}{b} + \frac{\left(a \cdot a\right) \cdot \left(c \cdot c\right)}{{b}^{3}}\right) + -4 \cdot \frac{{\left(a \cdot c\right)}^{3}}{{b}^{5}}\right) + \frac{{\left(a \cdot c\right)}^{4}}{{b}^{7}} \cdot -10}{a \cdot 2}\]
Alternative 11 Error 2.9 Cost 34432
\[\frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}} \cdot -5 + \left(\left(-2 \cdot \frac{c \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)}{{b}^{5}} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\right) - \frac{c}{b}\right)\]
Alternative 12 Error 43.5 Cost 34176
\[\frac{\frac{\sqrt{{b}^{6} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}}{\sqrt{{b}^{4} + 4 \cdot \left(\left(b \cdot b + \left(4 \cdot a\right) \cdot c\right) \cdot \left(a \cdot c\right)\right)}} - b}{a \cdot 2}\]
Alternative 13 Error 43.6 Cost 28096
\[\frac{{\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}^{3} - {b}^{3}}{\left(a \cdot 2\right) \cdot \left(b \cdot \left(b + \left(b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) + a \cdot \left(c \cdot -4\right)\right)}\]
Alternative 14 Error 43.6 Cost 28096
\[\frac{\frac{{\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}^{3} - {b}^{3}}{b \cdot \left(b + \left(b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) + a \cdot \left(c \cdot -4\right)}}{a \cdot 2}\]
Alternative 15 Error 43.9 Cost 27840
\[\frac{\sqrt{\sqrt[3]{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \left(\sqrt[3]{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt[3]{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} - b}{a \cdot 2}\]
Alternative 16 Error 43.6 Cost 27776
\[\frac{\sqrt{\frac{{b}^{6} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}{{b}^{4} + 4 \cdot \left(\left(b \cdot b + \left(4 \cdot a\right) \cdot c\right) \cdot \left(a \cdot c\right)\right)}} - b}{a \cdot 2}\]
Alternative 17 Error 43.6 Cost 27200
\[\frac{\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} - b}{a \cdot 2}\]
Alternative 18 Error 44.0 Cost 27200
\[\frac{\left|\sqrt[3]{b \cdot b - \left(4 \cdot a\right) \cdot c}\right| \cdot \sqrt{\sqrt[3]{b \cdot b - \left(4 \cdot a\right) \cdot c}} - b}{a \cdot 2}\]
Alternative 19 Error 49.9 Cost 26432
\[\log \left(\sqrt{e^{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a}}}\right)\]
Alternative 20 Error 4.2 Cost 21248
\[\frac{-2 \cdot \left(\frac{a \cdot c}{b} + \frac{\left(a \cdot a\right) \cdot \left(c \cdot c\right)}{{b}^{3}}\right) + -4 \cdot \frac{{\left(a \cdot c\right)}^{3}}{{b}^{5}}}{a \cdot 2}\]
Alternative 21 Error 43.6 Cost 20992
\[\frac{\frac{\sqrt{{b}^{4} - \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right) \cdot 16}}{\sqrt{b \cdot b + \left(4 \cdot a\right) \cdot c}} - b}{a \cdot 2}\]
Alternative 22 Error 3.9 Cost 20736
\[\left(-2 \cdot \frac{\left(a \cdot a\right) \cdot {c}^{3}}{{b}^{5}} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\right) - \frac{c}{b}\]
Alternative 23 Error 43.8 Cost 20224
\[\frac{\sqrt[3]{{\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}^{3}} - b}{a \cdot 2}\]
Alternative 24 Error 43.6 Cost 20224
\[\frac{\sqrt{\sqrt[3]{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{3}}} - b}{a \cdot 2}\]
Alternative 25 Error 43.5 Cost 20224
\[\sqrt[3]{{\left(\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2}\right)}^{3}}\]
Alternative 26 Error 43.5 Cost 20224
\[\frac{\sqrt[3]{{\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b\right)}^{3}}}{a \cdot 2}\]
Alternative 27 Error 44.3 Cost 20160
\[\frac{e^{\log \left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} - b}{a \cdot 2}\]
Alternative 28 Error 56.5 Cost 20160
\[\frac{\log \left(e^{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) - b}{a \cdot 2}\]
Alternative 29 Error 44.3 Cost 20160
\[\frac{\sqrt{e^{\log \left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}} - b}{a \cdot 2}\]
Alternative 30 Error 59.4 Cost 20160
\[\frac{\sqrt{\log \left(e^{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} - b}{a \cdot 2}\]
Alternative 31 Error 49.0 Cost 20160
\[\frac{\log \left(e^{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}\right)}{a \cdot 2}\]
Alternative 32 Error 43.6 Cost 14592
\[\frac{\sqrt{\frac{{b}^{4} - \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right) \cdot 16}{b \cdot b + \left(4 \cdot a\right) \cdot c}} - b}{a \cdot 2}\]
Alternative 33 Error 43.0 Cost 8256
\[\frac{\frac{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) - b \cdot b}{b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{a \cdot 2}\]
Alternative 34 Error 6.2 Cost 7808
\[\frac{-2 \cdot \left(\frac{a \cdot c}{b} + \frac{\left(a \cdot a\right) \cdot \left(c \cdot c\right)}{{b}^{3}}\right)}{a \cdot 2}\]
Alternative 35 Error 43.9 Cost 7616
\[\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} - \frac{b}{a \cdot 2}\]
Alternative 36 Error 43.5 Cost 7360
\[\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2}\]
Alternative 37 Error 6.0 Cost 7232
\[\left(-\frac{c}{b}\right) - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\]
Alternative 38 Error 12.4 Cost 704
\[\frac{-2 \cdot \frac{a \cdot c}{b}}{a \cdot 2}\]
Alternative 39 Error 12.2 Cost 256
\[-\frac{c}{b}\]
Alternative 40 Error 63.0 Cost 64
\[1\]
Alternative 41 Error 62.0 Cost 64
\[0\]
Alternative 42 Error 56.6 Cost 64
\[-1\]
Error Derivation Initial program 43.5
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
Simplified43.5
\[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2}}\]
Taylor expanded around inf 2.9
\[\leadsto \color{blue}{-\left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}} + \left(\frac{c}{b} + \left(\frac{a \cdot {c}^{2}}{{b}^{3}} + 2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}}\right)\right)\right)}\]
Simplified2.9
\[\leadsto \color{blue}{\left(\left(-2 \cdot \frac{\left(a \cdot a\right) \cdot {c}^{3}}{{b}^{5}} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\right) - \frac{c}{b}\right) + \frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}} \cdot -5}\]
Simplified2.9
\[\leadsto \color{blue}{\left(\left(-2 \cdot \frac{\left(a \cdot a\right) \cdot {c}^{3}}{{b}^{5}} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\right) - \frac{c}{b}\right) + \frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}} \cdot -5}\]
Final simplification2.9
\[\leadsto \left(\left(-2 \cdot \frac{\left(a \cdot a\right) \cdot {c}^{3}}{{b}^{5}} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\right) - \frac{c}{b}\right) + \frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}} \cdot -5\]
Reproduce herbie shell --seed 2021022
(FPCore (a b c)
:name "Quadratic roots, medium range"
:precision binary64
:pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))