
(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+153)
(- (/ c b) (/ b a))
(if (<= b 5e-112)
(/ (- (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+153) {
tmp = (c / b) - (b / a);
} else if (b <= 5e-112) {
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+153)) then
tmp = (c / b) - (b / a)
else if (b <= 5d-112) 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+153) {
tmp = (c / b) - (b / a);
} else if (b <= 5e-112) {
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+153: tmp = (c / b) - (b / a) elif b <= 5e-112: 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+153) tmp = Float64(Float64(c / b) - Float64(b / a)); elseif (b <= 5e-112) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)); else tmp = Float64(c / Float64(-b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e+153) tmp = (c / b) - (b / a); elseif (b <= 5e-112) 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+153], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5e-112], 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^{+153}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 5 \cdot 10^{-112}:\\
\;\;\;\;\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.00000000000000018e153Initial program 45.8%
*-commutative45.8%
Simplified45.8%
Taylor expanded in b around -inf 99.7%
+-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
if -5.00000000000000018e153 < b < 5.00000000000000044e-112Initial program 82.9%
if 5.00000000000000044e-112 < b Initial program 17.9%
*-commutative17.9%
Simplified17.9%
Taylor expanded in b around inf 86.7%
mul-1-neg86.7%
distribute-neg-frac286.7%
Simplified86.7%
Final simplification87.3%
(FPCore (a b c)
:precision binary64
(if (<= b -4.3e-44)
(- (/ c b) (/ b a))
(if (<= b 1.35e-116)
(* (/ 0.5 a) (- (sqrt (* a (* c -4.0))) b))
(/ c (- b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.3e-44) {
tmp = (c / b) - (b / a);
} else if (b <= 1.35e-116) {
tmp = (0.5 / a) * (sqrt((a * (c * -4.0))) - b);
} 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-44)) then
tmp = (c / b) - (b / a)
else if (b <= 1.35d-116) then
tmp = (0.5d0 / a) * (sqrt((a * (c * (-4.0d0)))) - b)
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-44) {
tmp = (c / b) - (b / a);
} else if (b <= 1.35e-116) {
tmp = (0.5 / a) * (Math.sqrt((a * (c * -4.0))) - b);
} else {
tmp = c / -b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.3e-44: tmp = (c / b) - (b / a) elif b <= 1.35e-116: tmp = (0.5 / a) * (math.sqrt((a * (c * -4.0))) - b) else: tmp = c / -b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.3e-44) tmp = Float64(Float64(c / b) - Float64(b / a)); elseif (b <= 1.35e-116) tmp = Float64(Float64(0.5 / a) * Float64(sqrt(Float64(a * Float64(c * -4.0))) - b)); else tmp = Float64(c / Float64(-b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.3e-44) tmp = (c / b) - (b / a); elseif (b <= 1.35e-116) tmp = (0.5 / a) * (sqrt((a * (c * -4.0))) - b); else tmp = c / -b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.3e-44], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.35e-116], N[(N[(0.5 / a), $MachinePrecision] * N[(N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], N[(c / (-b)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.3 \cdot 10^{-44}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 1.35 \cdot 10^{-116}:\\
\;\;\;\;\frac{0.5}{a} \cdot \left(\sqrt{a \cdot \left(c \cdot -4\right)} - b\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{-b}\\
\end{array}
\end{array}
if b < -4.30000000000000013e-44Initial program 67.9%
*-commutative67.9%
Simplified67.9%
Taylor expanded in b around -inf 89.8%
+-commutative89.8%
mul-1-neg89.8%
unsub-neg89.8%
Simplified89.8%
if -4.30000000000000013e-44 < b < 1.35e-116Initial program 78.2%
*-commutative78.2%
Simplified78.2%
Applied egg-rr78.1%
sub-neg78.1%
distribute-rgt-out--78.1%
Simplified78.1%
pow1/278.1%
metadata-eval78.1%
pow-pow77.8%
Applied egg-rr77.8%
Taylor expanded in a around inf 33.1%
*-commutative33.1%
exp-prod29.1%
+-commutative29.1%
mul-1-neg29.1%
log-rec29.1%
remove-double-neg29.1%
*-commutative29.1%
log-prod66.5%
rem-exp-log70.2%
unpow270.2%
pow-sqr70.5%
metadata-eval70.5%
unpow1/270.5%
Simplified70.5%
if 1.35e-116 < b Initial program 17.9%
*-commutative17.9%
Simplified17.9%
Taylor expanded in b around inf 86.7%
mul-1-neg86.7%
distribute-neg-frac286.7%
Simplified86.7%
Final simplification83.6%
(FPCore (a b c)
:precision binary64
(if (<= b -7.2e-42)
(- (/ c b) (/ b a))
(if (<= b 6.2e-112)
(/ (- b (sqrt (* a (* c -4.0)))) (* a -2.0))
(/ c (- b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.2e-42) {
tmp = (c / b) - (b / a);
} else if (b <= 6.2e-112) {
tmp = (b - sqrt((a * (c * -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 <= (-7.2d-42)) then
tmp = (c / b) - (b / a)
else if (b <= 6.2d-112) then
tmp = (b - sqrt((a * (c * (-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 <= -7.2e-42) {
tmp = (c / b) - (b / a);
} else if (b <= 6.2e-112) {
tmp = (b - Math.sqrt((a * (c * -4.0)))) / (a * -2.0);
} else {
tmp = c / -b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -7.2e-42: tmp = (c / b) - (b / a) elif b <= 6.2e-112: tmp = (b - math.sqrt((a * (c * -4.0)))) / (a * -2.0) else: tmp = c / -b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -7.2e-42) tmp = Float64(Float64(c / b) - Float64(b / a)); elseif (b <= 6.2e-112) tmp = Float64(Float64(b - sqrt(Float64(a * Float64(c * -4.0)))) / Float64(a * -2.0)); else tmp = Float64(c / Float64(-b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -7.2e-42) tmp = (c / b) - (b / a); elseif (b <= 6.2e-112) tmp = (b - sqrt((a * (c * -4.0)))) / (a * -2.0); else tmp = c / -b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -7.2e-42], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.2e-112], N[(N[(b - N[Sqrt[N[(a * N[(c * -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 -7.2 \cdot 10^{-42}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 6.2 \cdot 10^{-112}:\\
\;\;\;\;\frac{b - \sqrt{a \cdot \left(c \cdot -4\right)}}{a \cdot -2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{-b}\\
\end{array}
\end{array}
if b < -7.2000000000000004e-42Initial program 67.9%
*-commutative67.9%
Simplified67.9%
Taylor expanded in b around -inf 89.8%
+-commutative89.8%
mul-1-neg89.8%
unsub-neg89.8%
Simplified89.8%
if -7.2000000000000004e-42 < b < 6.1999999999999995e-112Initial program 78.2%
*-commutative78.2%
Simplified78.2%
add-sqr-sqrt77.7%
pow277.7%
pow1/277.7%
sqrt-pow177.9%
sub-neg77.9%
+-commutative77.9%
distribute-lft-neg-in77.9%
*-commutative77.9%
distribute-rgt-neg-in77.9%
metadata-eval77.9%
associate-*r*77.9%
*-commutative77.9%
fma-undefine77.9%
pow277.9%
metadata-eval77.9%
Applied egg-rr77.9%
Taylor expanded in b around 0 70.2%
associate-*r*70.2%
*-commutative70.2%
Simplified70.2%
frac-2neg70.2%
div-inv70.2%
distribute-neg-in70.2%
add-sqr-sqrt45.5%
sqrt-unprod69.0%
sqr-neg69.0%
sqrt-prod25.0%
add-sqr-sqrt68.1%
sub-neg68.1%
add-sqr-sqrt43.1%
sqrt-unprod67.9%
sqr-neg67.9%
sqrt-prod24.7%
add-sqr-sqrt70.2%
pow-pow70.5%
metadata-eval70.5%
pow1/270.5%
associate-*l*70.5%
*-commutative70.5%
Applied egg-rr70.5%
associate-*r/70.5%
*-rgt-identity70.5%
*-commutative70.5%
Simplified70.5%
if 6.1999999999999995e-112 < b Initial program 17.9%
*-commutative17.9%
Simplified17.9%
Taylor expanded in b around inf 86.7%
mul-1-neg86.7%
distribute-neg-frac286.7%
Simplified86.7%
Final simplification83.6%
(FPCore (a b c) :precision binary64 (if (<= b -5e-311) (- (/ c b) (/ b a)) (/ c (- b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
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 <= (-5d-311)) 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 <= -5e-311) {
tmp = (c / b) - (b / a);
} else {
tmp = c / -b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-311: tmp = (c / b) - (b / a) else: tmp = c / -b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = Float64(Float64(c / b) - Float64(b / a)); else tmp = Float64(c / Float64(-b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-311) tmp = (c / b) - (b / a); else tmp = c / -b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], N[(c / (-b)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{-b}\\
\end{array}
\end{array}
if b < -5.00000000000023e-311Initial program 73.3%
*-commutative73.3%
Simplified73.3%
Taylor expanded in b around -inf 68.8%
+-commutative68.8%
mul-1-neg68.8%
unsub-neg68.8%
Simplified68.8%
if -5.00000000000023e-311 < b Initial program 26.9%
*-commutative26.9%
Simplified26.9%
Taylor expanded in b around inf 73.9%
mul-1-neg73.9%
distribute-neg-frac273.9%
Simplified73.9%
Final simplification71.5%
(FPCore (a b c) :precision binary64 (if (<= b 1.3e+29) (/ b (- a)) (/ c b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.3e+29) {
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 <= 1.3d+29) 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 <= 1.3e+29) {
tmp = b / -a;
} else {
tmp = c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.3e+29: tmp = b / -a else: tmp = c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.3e+29) tmp = Float64(b / Float64(-a)); else tmp = Float64(c / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.3e+29) tmp = b / -a; else tmp = c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.3e+29], N[(b / (-a)), $MachinePrecision], N[(c / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.3 \cdot 10^{+29}:\\
\;\;\;\;\frac{b}{-a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b}\\
\end{array}
\end{array}
if b < 1.3e29Initial program 64.1%
*-commutative64.1%
Simplified64.1%
Taylor expanded in b around -inf 46.7%
mul-1-neg46.7%
distribute-neg-frac246.7%
Simplified46.7%
if 1.3e29 < b Initial program 11.0%
*-commutative11.0%
Simplified11.0%
Applied egg-rr3.5%
unpow-13.5%
Simplified3.5%
Taylor expanded in b around -inf 37.1%
Final simplification44.1%
(FPCore (a b c) :precision binary64 (if (<= b -5e-311) (/ b (- a)) (/ c (- b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
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 <= (-5d-311)) 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 <= -5e-311) {
tmp = b / -a;
} else {
tmp = c / -b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-311: tmp = b / -a else: tmp = c / -b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = Float64(b / Float64(-a)); else tmp = Float64(c / Float64(-b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-311) tmp = b / -a; else tmp = c / -b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[(b / (-a)), $MachinePrecision], N[(c / (-b)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{b}{-a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{-b}\\
\end{array}
\end{array}
if b < -5.00000000000023e-311Initial program 73.3%
*-commutative73.3%
Simplified73.3%
Taylor expanded in b around -inf 68.1%
mul-1-neg68.1%
distribute-neg-frac268.1%
Simplified68.1%
if -5.00000000000023e-311 < b Initial program 26.9%
*-commutative26.9%
Simplified26.9%
Taylor expanded in b around inf 73.9%
mul-1-neg73.9%
distribute-neg-frac273.9%
Simplified73.9%
Final simplification71.1%
(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 49.4%
*-commutative49.4%
Simplified49.4%
Applied egg-rr31.5%
unpow-131.5%
Simplified31.5%
Taylor expanded in a around 0 2.4%
Final simplification2.4%
(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 49.4%
*-commutative49.4%
Simplified49.4%
Applied egg-rr31.5%
unpow-131.5%
Simplified31.5%
Taylor expanded in b around -inf 12.5%
Final simplification12.5%
herbie shell --seed 2024050
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))