
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-b + sqrt(((b * b) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-b + sqrt(((b * b) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\end{array}
(FPCore (a b c)
:precision binary64
(if (<= b -5e+93)
(- (/ c b) (/ b a))
(if (<= b 1.95e-57)
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0))
(/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e+93) {
tmp = (c / b) - (b / a);
} else if (b <= 1.95e-57) {
tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
} else {
tmp = -c / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d+93)) then
tmp = (c / b) - (b / a)
else if (b <= 1.95d-57) then
tmp = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)
else
tmp = -c / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e+93) {
tmp = (c / b) - (b / a);
} else if (b <= 1.95e-57) {
tmp = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e+93: tmp = (c / b) - (b / a) elif b <= 1.95e-57: tmp = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e+93) tmp = Float64(Float64(c / b) - Float64(b / a)); elseif (b <= 1.95e-57) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)); else tmp = Float64(Float64(-c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e+93) tmp = (c / b) - (b / a); elseif (b <= 1.95e-57) tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e+93], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.95e-57], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{+93}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 1.95 \cdot 10^{-57}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -5.0000000000000001e93Initial program 52.9%
Taylor expanded in b around -inf 93.5%
+-commutative93.5%
mul-1-neg93.5%
unsub-neg93.5%
Simplified93.5%
if -5.0000000000000001e93 < b < 1.95000000000000003e-57Initial program 77.5%
if 1.95000000000000003e-57 < b Initial program 14.4%
Taylor expanded in b around inf 86.2%
associate-*r/86.2%
neg-mul-186.2%
Simplified86.2%
Final simplification84.2%
(FPCore (a b c)
:precision binary64
(if (<= b -4.5e-69)
(/ (- (- (/ (* a 2.0) (/ b c)) b) b) (* a 2.0))
(if (<= b 4.9e-57)
(/ (+ b (sqrt (* c (* a -4.0)))) (* a 2.0))
(/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.5e-69) {
tmp = ((((a * 2.0) / (b / c)) - b) - b) / (a * 2.0);
} else if (b <= 4.9e-57) {
tmp = (b + sqrt((c * (a * -4.0)))) / (a * 2.0);
} else {
tmp = -c / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-4.5d-69)) then
tmp = ((((a * 2.0d0) / (b / c)) - b) - b) / (a * 2.0d0)
else if (b <= 4.9d-57) then
tmp = (b + sqrt((c * (a * (-4.0d0))))) / (a * 2.0d0)
else
tmp = -c / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -4.5e-69) {
tmp = ((((a * 2.0) / (b / c)) - b) - b) / (a * 2.0);
} else if (b <= 4.9e-57) {
tmp = (b + Math.sqrt((c * (a * -4.0)))) / (a * 2.0);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.5e-69: tmp = ((((a * 2.0) / (b / c)) - b) - b) / (a * 2.0) elif b <= 4.9e-57: tmp = (b + math.sqrt((c * (a * -4.0)))) / (a * 2.0) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.5e-69) tmp = Float64(Float64(Float64(Float64(Float64(a * 2.0) / Float64(b / c)) - b) - b) / Float64(a * 2.0)); elseif (b <= 4.9e-57) tmp = Float64(Float64(b + sqrt(Float64(c * Float64(a * -4.0)))) / Float64(a * 2.0)); else tmp = Float64(Float64(-c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.5e-69) tmp = ((((a * 2.0) / (b / c)) - b) - b) / (a * 2.0); elseif (b <= 4.9e-57) tmp = (b + sqrt((c * (a * -4.0)))) / (a * 2.0); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.5e-69], N[(N[(N[(N[(N[(a * 2.0), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.9e-57], N[(N[(b + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.5 \cdot 10^{-69}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 2}{\frac{b}{c}} - b\right) - b}{a \cdot 2}\\
\mathbf{elif}\;b \leq 4.9 \cdot 10^{-57}:\\
\;\;\;\;\frac{b + \sqrt{c \cdot \left(a \cdot -4\right)}}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -4.50000000000000009e-69Initial program 67.4%
add-cube-cbrt67.2%
pow367.2%
add-sqr-sqrt67.1%
cbrt-prod66.8%
cbrt-prod67.1%
add-sqr-sqrt67.2%
fma-neg67.2%
*-commutative67.2%
distribute-rgt-neg-in67.2%
*-commutative67.2%
distribute-rgt-neg-in67.2%
metadata-eval67.2%
Applied egg-rr67.2%
Taylor expanded in b around -inf 87.5%
+-commutative87.5%
mul-1-neg87.5%
unsub-neg87.5%
associate-/l*89.0%
associate-*r/89.0%
*-commutative89.0%
Simplified89.0%
if -4.50000000000000009e-69 < b < 4.89999999999999988e-57Initial program 70.6%
Taylor expanded in b around 0 65.5%
*-commutative65.5%
*-commutative65.5%
associate-*r*65.5%
Simplified65.5%
expm1-log1p-u47.1%
expm1-udef19.3%
add-sqr-sqrt10.4%
sqrt-unprod18.9%
sqr-neg18.9%
sqrt-unprod8.7%
add-sqr-sqrt18.4%
*-commutative18.4%
Applied egg-rr18.4%
expm1-def45.8%
expm1-log1p64.1%
Simplified64.1%
if 4.89999999999999988e-57 < b Initial program 14.4%
Taylor expanded in b around inf 86.2%
associate-*r/86.2%
neg-mul-186.2%
Simplified86.2%
Final simplification80.4%
(FPCore (a b c)
:precision binary64
(if (<= b -4.3e-69)
(/ (- (- (/ (* a 2.0) (/ b c)) b) b) (* a 2.0))
(if (<= b 9.2e-57)
(/ (- (sqrt (* c (* a -4.0))) b) (* a 2.0))
(/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.3e-69) {
tmp = ((((a * 2.0) / (b / c)) - b) - b) / (a * 2.0);
} else if (b <= 9.2e-57) {
tmp = (sqrt((c * (a * -4.0))) - b) / (a * 2.0);
} else {
tmp = -c / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-4.3d-69)) then
tmp = ((((a * 2.0d0) / (b / c)) - b) - b) / (a * 2.0d0)
else if (b <= 9.2d-57) then
tmp = (sqrt((c * (a * (-4.0d0)))) - b) / (a * 2.0d0)
else
tmp = -c / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -4.3e-69) {
tmp = ((((a * 2.0) / (b / c)) - b) - b) / (a * 2.0);
} else if (b <= 9.2e-57) {
tmp = (Math.sqrt((c * (a * -4.0))) - b) / (a * 2.0);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.3e-69: tmp = ((((a * 2.0) / (b / c)) - b) - b) / (a * 2.0) elif b <= 9.2e-57: tmp = (math.sqrt((c * (a * -4.0))) - b) / (a * 2.0) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.3e-69) tmp = Float64(Float64(Float64(Float64(Float64(a * 2.0) / Float64(b / c)) - b) - b) / Float64(a * 2.0)); elseif (b <= 9.2e-57) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -4.0))) - b) / Float64(a * 2.0)); else tmp = Float64(Float64(-c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.3e-69) tmp = ((((a * 2.0) / (b / c)) - b) - b) / (a * 2.0); elseif (b <= 9.2e-57) tmp = (sqrt((c * (a * -4.0))) - b) / (a * 2.0); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.3e-69], N[(N[(N[(N[(N[(a * 2.0), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9.2e-57], N[(N[(N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.3 \cdot 10^{-69}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 2}{\frac{b}{c}} - b\right) - b}{a \cdot 2}\\
\mathbf{elif}\;b \leq 9.2 \cdot 10^{-57}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -4.3e-69Initial program 67.4%
add-cube-cbrt67.2%
pow367.2%
add-sqr-sqrt67.1%
cbrt-prod66.8%
cbrt-prod67.1%
add-sqr-sqrt67.2%
fma-neg67.2%
*-commutative67.2%
distribute-rgt-neg-in67.2%
*-commutative67.2%
distribute-rgt-neg-in67.2%
metadata-eval67.2%
Applied egg-rr67.2%
Taylor expanded in b around -inf 87.5%
+-commutative87.5%
mul-1-neg87.5%
unsub-neg87.5%
associate-/l*89.0%
associate-*r/89.0%
*-commutative89.0%
Simplified89.0%
if -4.3e-69 < b < 9.2000000000000001e-57Initial program 70.6%
Taylor expanded in b around 0 65.5%
*-commutative65.5%
*-commutative65.5%
associate-*r*65.5%
Simplified65.5%
if 9.2000000000000001e-57 < b Initial program 14.4%
Taylor expanded in b around inf 86.2%
associate-*r/86.2%
neg-mul-186.2%
Simplified86.2%
Final simplification80.8%
(FPCore (a b c) :precision binary64 (if (<= b -1e-310) (- (/ c b) (/ b a)) (/ (- c) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = (c / b) - (b / a);
} else {
tmp = -c / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1d-310)) then
tmp = (c / b) - (b / a)
else
tmp = -c / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = (c / b) - (b / a);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-310: tmp = (c / b) - (b / a) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-310) tmp = Float64(Float64(c / b) - Float64(b / a)); else tmp = Float64(Float64(-c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-310) tmp = (c / b) - (b / a); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-310], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 68.1%
Taylor expanded in b around -inf 64.8%
+-commutative64.8%
mul-1-neg64.8%
unsub-neg64.8%
Simplified64.8%
if -9.999999999999969e-311 < b Initial program 30.0%
Taylor expanded in b around inf 67.9%
associate-*r/67.9%
neg-mul-167.9%
Simplified67.9%
Final simplification66.4%
(FPCore (a b c) :precision binary64 (if (<= b 9.5e+33) (/ (- b) a) (/ c b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 9.5e+33) {
tmp = -b / a;
} else {
tmp = c / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 9.5d+33) then
tmp = -b / a
else
tmp = c / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 9.5e+33) {
tmp = -b / a;
} else {
tmp = c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 9.5e+33: tmp = -b / a else: tmp = c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 9.5e+33) tmp = Float64(Float64(-b) / a); else tmp = Float64(c / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 9.5e+33) tmp = -b / a; else tmp = c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 9.5e+33], N[((-b) / a), $MachinePrecision], N[(c / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 9.5 \cdot 10^{+33}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b}\\
\end{array}
\end{array}
if b < 9.5000000000000003e33Initial program 65.6%
Taylor expanded in b around -inf 46.0%
associate-*r/46.0%
mul-1-neg46.0%
Simplified46.0%
if 9.5000000000000003e33 < b Initial program 9.3%
clear-num9.3%
inv-pow9.3%
Applied egg-rr3.1%
Taylor expanded in b around -inf 0.0%
associate-*r/0.0%
rem-square-sqrt0.0%
unpow20.0%
*-commutative0.0%
times-frac0.0%
unpow20.0%
rem-square-sqrt0.0%
unpow20.0%
rem-square-sqrt31.6%
metadata-eval31.6%
Simplified31.6%
Taylor expanded in b around 0 31.6%
Final simplification41.7%
(FPCore (a b c) :precision binary64 (if (<= b 1e-261) (/ (- b) a) (/ (- c) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1e-261) {
tmp = -b / a;
} else {
tmp = -c / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 1d-261) then
tmp = -b / a
else
tmp = -c / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1e-261) {
tmp = -b / a;
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1e-261: tmp = -b / a else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1e-261) tmp = Float64(Float64(-b) / a); else tmp = Float64(Float64(-c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1e-261) tmp = -b / a; else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1e-261], N[((-b) / a), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 10^{-261}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < 9.99999999999999984e-262Initial program 68.6%
Taylor expanded in b around -inf 61.8%
associate-*r/61.8%
mul-1-neg61.8%
Simplified61.8%
if 9.99999999999999984e-262 < b Initial program 28.0%
Taylor expanded in b around inf 70.5%
associate-*r/70.5%
neg-mul-170.5%
Simplified70.5%
Final simplification66.0%
(FPCore (a b c) :precision binary64 (/ b a))
double code(double a, double b, double c) {
return b / a;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = b / a
end function
public static double code(double a, double b, double c) {
return b / a;
}
def code(a, b, c): return b / a
function code(a, b, c) return Float64(b / a) end
function tmp = code(a, b, c) tmp = b / a; end
code[a_, b_, c_] := N[(b / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{b}{a}
\end{array}
Initial program 48.9%
clear-num48.8%
inv-pow48.8%
Applied egg-rr25.0%
Taylor expanded in a around 0 2.5%
Final simplification2.5%
(FPCore (a b c) :precision binary64 (/ c b))
double code(double a, double b, double c) {
return c / b;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = c / b
end function
public static double code(double a, double b, double c) {
return c / b;
}
def code(a, b, c): return c / b
function code(a, b, c) return Float64(c / b) end
function tmp = code(a, b, c) tmp = c / b; end
code[a_, b_, c_] := N[(c / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{c}{b}
\end{array}
Initial program 48.9%
clear-num48.8%
inv-pow48.8%
Applied egg-rr25.0%
Taylor expanded in b around -inf 0.0%
associate-*r/0.0%
rem-square-sqrt0.0%
unpow20.0%
*-commutative0.0%
times-frac0.0%
unpow20.0%
rem-square-sqrt0.0%
unpow20.0%
rem-square-sqrt11.7%
metadata-eval11.7%
Simplified11.7%
Taylor expanded in b around 0 11.7%
Final simplification11.7%
herbie shell --seed 2023287
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))