
(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(4.0 * Float64(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[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 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(4.0 * Float64(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[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}
\end{array}
(FPCore (a b c)
:precision binary64
(if (<= b -1.6e+153)
(/ b (- a))
(if (<= b 1.22e-57)
(/ (- (sqrt (- (* b b) (* 4.0 (* a c)))) b) (* a 2.0))
(/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.6e+153) {
tmp = b / -a;
} else if (b <= 1.22e-57) {
tmp = (sqrt(((b * b) - (4.0 * (a * c)))) - 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 <= (-1.6d+153)) then
tmp = b / -a
else if (b <= 1.22d-57) then
tmp = (sqrt(((b * b) - (4.0d0 * (a * c)))) - 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 <= -1.6e+153) {
tmp = b / -a;
} else if (b <= 1.22e-57) {
tmp = (Math.sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.6e+153: tmp = b / -a elif b <= 1.22e-57: tmp = (math.sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.6e+153) tmp = Float64(b / Float64(-a)); elseif (b <= 1.22e-57) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c)))) - 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 <= -1.6e+153) tmp = b / -a; elseif (b <= 1.22e-57) tmp = (sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.6e+153], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, 1.22e-57], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(a * c), $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 -1.6 \cdot 10^{+153}:\\
\;\;\;\;\frac{b}{-a}\\
\mathbf{elif}\;b \leq 1.22 \cdot 10^{-57}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -1.6000000000000001e153Initial program 28.6%
*-commutative28.6%
+-commutative28.6%
unsub-neg28.6%
fmm-def28.6%
*-commutative28.6%
associate-*r*28.6%
distribute-lft-neg-in28.6%
*-commutative28.6%
distribute-rgt-neg-in28.6%
associate-*r*28.6%
metadata-eval28.6%
Simplified28.6%
Taylor expanded in b around -inf 97.7%
associate-*r/97.7%
mul-1-neg97.7%
Simplified97.7%
if -1.6000000000000001e153 < b < 1.2200000000000001e-57Initial program 85.3%
if 1.2200000000000001e-57 < b Initial program 15.5%
*-commutative15.5%
+-commutative15.5%
unsub-neg15.5%
fmm-def15.5%
*-commutative15.5%
associate-*r*15.5%
distribute-lft-neg-in15.5%
*-commutative15.5%
distribute-rgt-neg-in15.5%
associate-*r*15.5%
metadata-eval15.5%
Simplified15.5%
Taylor expanded in b around inf 85.6%
mul-1-neg85.6%
distribute-neg-frac285.6%
Simplified85.6%
Final simplification87.3%
(FPCore (a b c)
:precision binary64
(if (<= b -4.4e-109)
(/ b (- a))
(if (<= b 7.6e-255)
(* 0.5 (sqrt (* -4.0 (/ c a))))
(if (<= b 4.8e-157) (* -0.5 (sqrt (* c (/ -4.0 a)))) (/ (- c) b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.4e-109) {
tmp = b / -a;
} else if (b <= 7.6e-255) {
tmp = 0.5 * sqrt((-4.0 * (c / a)));
} else if (b <= 4.8e-157) {
tmp = -0.5 * sqrt((c * (-4.0 / 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 <= (-4.4d-109)) then
tmp = b / -a
else if (b <= 7.6d-255) then
tmp = 0.5d0 * sqrt(((-4.0d0) * (c / a)))
else if (b <= 4.8d-157) then
tmp = (-0.5d0) * sqrt((c * ((-4.0d0) / 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 <= -4.4e-109) {
tmp = b / -a;
} else if (b <= 7.6e-255) {
tmp = 0.5 * Math.sqrt((-4.0 * (c / a)));
} else if (b <= 4.8e-157) {
tmp = -0.5 * Math.sqrt((c * (-4.0 / a)));
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.4e-109: tmp = b / -a elif b <= 7.6e-255: tmp = 0.5 * math.sqrt((-4.0 * (c / a))) elif b <= 4.8e-157: tmp = -0.5 * math.sqrt((c * (-4.0 / a))) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.4e-109) tmp = Float64(b / Float64(-a)); elseif (b <= 7.6e-255) tmp = Float64(0.5 * sqrt(Float64(-4.0 * Float64(c / a)))); elseif (b <= 4.8e-157) tmp = Float64(-0.5 * sqrt(Float64(c * Float64(-4.0 / a)))); else tmp = Float64(Float64(-c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.4e-109) tmp = b / -a; elseif (b <= 7.6e-255) tmp = 0.5 * sqrt((-4.0 * (c / a))); elseif (b <= 4.8e-157) tmp = -0.5 * sqrt((c * (-4.0 / a))); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.4e-109], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, 7.6e-255], N[(0.5 * N[Sqrt[N[(-4.0 * N[(c / a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.8e-157], N[(-0.5 * N[Sqrt[N[(c * N[(-4.0 / a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.4 \cdot 10^{-109}:\\
\;\;\;\;\frac{b}{-a}\\
\mathbf{elif}\;b \leq 7.6 \cdot 10^{-255}:\\
\;\;\;\;0.5 \cdot \sqrt{-4 \cdot \frac{c}{a}}\\
\mathbf{elif}\;b \leq 4.8 \cdot 10^{-157}:\\
\;\;\;\;-0.5 \cdot \sqrt{c \cdot \frac{-4}{a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -4.3999999999999999e-109Initial program 68.7%
*-commutative68.7%
+-commutative68.7%
unsub-neg68.7%
fmm-def68.7%
*-commutative68.7%
associate-*r*68.7%
distribute-lft-neg-in68.7%
*-commutative68.7%
distribute-rgt-neg-in68.7%
associate-*r*67.8%
metadata-eval67.8%
Simplified67.8%
Taylor expanded in b around -inf 80.1%
associate-*r/80.1%
mul-1-neg80.1%
Simplified80.1%
if -4.3999999999999999e-109 < b < 7.6e-255Initial program 82.6%
*-commutative82.6%
Simplified82.6%
add-cube-cbrt81.9%
pow381.9%
*-commutative81.9%
associate-*l*81.9%
Applied egg-rr81.9%
Taylor expanded in a around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt43.8%
rem-cube-cbrt44.2%
associate-/l*44.1%
Simplified44.1%
pow144.1%
associate-*r*44.1%
metadata-eval44.1%
Applied egg-rr44.1%
unpow144.1%
associate-*r/44.2%
*-commutative44.2%
associate-*r/44.2%
Simplified44.2%
if 7.6e-255 < b < 4.8e-157Initial program 81.9%
*-commutative81.9%
Simplified81.9%
add-cube-cbrt81.1%
pow381.0%
*-commutative81.0%
associate-*l*81.0%
Applied egg-rr81.0%
Taylor expanded in a around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt11.9%
rem-cube-cbrt12.1%
associate-/l*12.1%
Simplified12.1%
add-sqr-sqrt1.1%
sqrt-unprod60.8%
mul-1-neg60.8%
mul-1-neg60.8%
sqr-neg60.8%
add-sqr-sqrt60.8%
Applied egg-rr60.8%
if 4.8e-157 < b Initial program 20.6%
*-commutative20.6%
+-commutative20.6%
unsub-neg20.6%
fmm-def20.6%
*-commutative20.6%
associate-*r*20.6%
distribute-lft-neg-in20.6%
*-commutative20.6%
distribute-rgt-neg-in20.6%
associate-*r*20.6%
metadata-eval20.6%
Simplified20.6%
Taylor expanded in b around inf 80.3%
mul-1-neg80.3%
distribute-neg-frac280.3%
Simplified80.3%
Final simplification73.4%
(FPCore (a b c)
:precision binary64
(if (<= b -1.4e-62)
(* b (+ (/ c (pow b 2.0)) (/ -1.0 a)))
(if (<= b 1.5e-141)
(/ (- (sqrt (* a (* c -4.0))) b) (* a 2.0))
(/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.4e-62) {
tmp = b * ((c / pow(b, 2.0)) + (-1.0 / a));
} else if (b <= 1.5e-141) {
tmp = (sqrt((a * (c * -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 <= (-1.4d-62)) then
tmp = b * ((c / (b ** 2.0d0)) + ((-1.0d0) / a))
else if (b <= 1.5d-141) then
tmp = (sqrt((a * (c * (-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 <= -1.4e-62) {
tmp = b * ((c / Math.pow(b, 2.0)) + (-1.0 / a));
} else if (b <= 1.5e-141) {
tmp = (Math.sqrt((a * (c * -4.0))) - b) / (a * 2.0);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.4e-62: tmp = b * ((c / math.pow(b, 2.0)) + (-1.0 / a)) elif b <= 1.5e-141: tmp = (math.sqrt((a * (c * -4.0))) - b) / (a * 2.0) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.4e-62) tmp = Float64(b * Float64(Float64(c / (b ^ 2.0)) + Float64(-1.0 / a))); elseif (b <= 1.5e-141) tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -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 <= -1.4e-62) tmp = b * ((c / (b ^ 2.0)) + (-1.0 / a)); elseif (b <= 1.5e-141) tmp = (sqrt((a * (c * -4.0))) - b) / (a * 2.0); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.4e-62], N[(b * N[(N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.5e-141], N[(N[(N[Sqrt[N[(a * N[(c * -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 -1.4 \cdot 10^{-62}:\\
\;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} + \frac{-1}{a}\right)\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{-141}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -4\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -1.40000000000000001e-62Initial program 66.5%
*-commutative66.5%
+-commutative66.5%
unsub-neg66.5%
fmm-def66.5%
*-commutative66.5%
associate-*r*66.5%
distribute-lft-neg-in66.5%
*-commutative66.5%
distribute-rgt-neg-in66.5%
associate-*r*65.5%
metadata-eval65.5%
Simplified65.5%
Taylor expanded in b around -inf 84.8%
mul-1-neg84.8%
*-commutative84.8%
distribute-rgt-neg-in84.8%
+-commutative84.8%
mul-1-neg84.8%
unsub-neg84.8%
Simplified84.8%
if -1.40000000000000001e-62 < b < 1.49999999999999992e-141Initial program 82.9%
*-commutative82.9%
+-commutative82.9%
unsub-neg82.9%
fmm-def82.9%
*-commutative82.9%
associate-*r*82.9%
distribute-lft-neg-in82.9%
*-commutative82.9%
distribute-rgt-neg-in82.9%
associate-*r*82.9%
metadata-eval82.9%
Simplified82.9%
Taylor expanded in b around 0 74.8%
*-commutative74.8%
associate-*r*74.8%
Simplified74.8%
if 1.49999999999999992e-141 < b Initial program 19.1%
*-commutative19.1%
+-commutative19.1%
unsub-neg19.1%
fmm-def19.1%
*-commutative19.1%
associate-*r*19.1%
distribute-lft-neg-in19.1%
*-commutative19.1%
distribute-rgt-neg-in19.1%
associate-*r*19.1%
metadata-eval19.1%
Simplified19.1%
Taylor expanded in b around inf 81.6%
mul-1-neg81.6%
distribute-neg-frac281.6%
Simplified81.6%
Final simplification81.1%
(FPCore (a b c)
:precision binary64
(if (<= b -1.05e-63)
(* b (+ (/ c (pow b 2.0)) (/ -1.0 a)))
(if (<= b 1.5e-141)
(* (/ 1.0 a) (/ (sqrt (* a (* c -4.0))) 2.0))
(/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.05e-63) {
tmp = b * ((c / pow(b, 2.0)) + (-1.0 / a));
} else if (b <= 1.5e-141) {
tmp = (1.0 / a) * (sqrt((a * (c * -4.0))) / 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 <= (-1.05d-63)) then
tmp = b * ((c / (b ** 2.0d0)) + ((-1.0d0) / a))
else if (b <= 1.5d-141) then
tmp = (1.0d0 / a) * (sqrt((a * (c * (-4.0d0)))) / 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 <= -1.05e-63) {
tmp = b * ((c / Math.pow(b, 2.0)) + (-1.0 / a));
} else if (b <= 1.5e-141) {
tmp = (1.0 / a) * (Math.sqrt((a * (c * -4.0))) / 2.0);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.05e-63: tmp = b * ((c / math.pow(b, 2.0)) + (-1.0 / a)) elif b <= 1.5e-141: tmp = (1.0 / a) * (math.sqrt((a * (c * -4.0))) / 2.0) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.05e-63) tmp = Float64(b * Float64(Float64(c / (b ^ 2.0)) + Float64(-1.0 / a))); elseif (b <= 1.5e-141) tmp = Float64(Float64(1.0 / a) * Float64(sqrt(Float64(a * Float64(c * -4.0))) / 2.0)); else tmp = Float64(Float64(-c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.05e-63) tmp = b * ((c / (b ^ 2.0)) + (-1.0 / a)); elseif (b <= 1.5e-141) tmp = (1.0 / a) * (sqrt((a * (c * -4.0))) / 2.0); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.05e-63], N[(b * N[(N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.5e-141], N[(N[(1.0 / a), $MachinePrecision] * N[(N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.05 \cdot 10^{-63}:\\
\;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} + \frac{-1}{a}\right)\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{-141}:\\
\;\;\;\;\frac{1}{a} \cdot \frac{\sqrt{a \cdot \left(c \cdot -4\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -1.05e-63Initial program 66.5%
*-commutative66.5%
+-commutative66.5%
unsub-neg66.5%
fmm-def66.5%
*-commutative66.5%
associate-*r*66.5%
distribute-lft-neg-in66.5%
*-commutative66.5%
distribute-rgt-neg-in66.5%
associate-*r*65.5%
metadata-eval65.5%
Simplified65.5%
Taylor expanded in b around -inf 84.8%
mul-1-neg84.8%
*-commutative84.8%
distribute-rgt-neg-in84.8%
+-commutative84.8%
mul-1-neg84.8%
unsub-neg84.8%
Simplified84.8%
if -1.05e-63 < b < 1.49999999999999992e-141Initial program 82.9%
*-commutative82.9%
Simplified82.9%
add-cube-cbrt82.3%
pow382.3%
*-commutative82.3%
associate-*l*82.3%
Applied egg-rr82.3%
Taylor expanded in a around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt73.1%
rem-cube-cbrt73.4%
distribute-lft-neg-in73.4%
metadata-eval73.4%
*-lft-identity73.4%
associate-*r*73.4%
*-commutative73.4%
*-commutative73.4%
Simplified73.4%
*-un-lft-identity73.4%
times-frac73.5%
*-commutative73.5%
*-commutative73.5%
associate-*r*73.5%
Applied egg-rr73.5%
if 1.49999999999999992e-141 < b Initial program 19.1%
*-commutative19.1%
+-commutative19.1%
unsub-neg19.1%
fmm-def19.1%
*-commutative19.1%
associate-*r*19.1%
distribute-lft-neg-in19.1%
*-commutative19.1%
distribute-rgt-neg-in19.1%
associate-*r*19.1%
metadata-eval19.1%
Simplified19.1%
Taylor expanded in b around inf 81.6%
mul-1-neg81.6%
distribute-neg-frac281.6%
Simplified81.6%
Final simplification80.7%
(FPCore (a b c) :precision binary64 (if (<= b -1.3e-63) (* b (+ (/ c (pow b 2.0)) (/ -1.0 a))) (if (<= b 1.5e-141) (/ (sqrt (* (* a c) -4.0)) (* a 2.0)) (/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.3e-63) {
tmp = b * ((c / pow(b, 2.0)) + (-1.0 / a));
} else if (b <= 1.5e-141) {
tmp = 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 <= (-1.3d-63)) then
tmp = b * ((c / (b ** 2.0d0)) + ((-1.0d0) / a))
else if (b <= 1.5d-141) then
tmp = 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 <= -1.3e-63) {
tmp = b * ((c / Math.pow(b, 2.0)) + (-1.0 / a));
} else if (b <= 1.5e-141) {
tmp = Math.sqrt(((a * c) * -4.0)) / (a * 2.0);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.3e-63: tmp = b * ((c / math.pow(b, 2.0)) + (-1.0 / a)) elif b <= 1.5e-141: tmp = 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 <= -1.3e-63) tmp = Float64(b * Float64(Float64(c / (b ^ 2.0)) + Float64(-1.0 / a))); elseif (b <= 1.5e-141) tmp = Float64(sqrt(Float64(Float64(a * c) * -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 <= -1.3e-63) tmp = b * ((c / (b ^ 2.0)) + (-1.0 / a)); elseif (b <= 1.5e-141) tmp = sqrt(((a * c) * -4.0)) / (a * 2.0); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.3e-63], N[(b * N[(N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.5e-141], N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -4.0), $MachinePrecision]], $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.3 \cdot 10^{-63}:\\
\;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} + \frac{-1}{a}\right)\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{-141}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot c\right) \cdot -4}}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -1.3000000000000001e-63Initial program 66.5%
*-commutative66.5%
+-commutative66.5%
unsub-neg66.5%
fmm-def66.5%
*-commutative66.5%
associate-*r*66.5%
distribute-lft-neg-in66.5%
*-commutative66.5%
distribute-rgt-neg-in66.5%
associate-*r*65.5%
metadata-eval65.5%
Simplified65.5%
Taylor expanded in b around -inf 84.8%
mul-1-neg84.8%
*-commutative84.8%
distribute-rgt-neg-in84.8%
+-commutative84.8%
mul-1-neg84.8%
unsub-neg84.8%
Simplified84.8%
if -1.3000000000000001e-63 < b < 1.49999999999999992e-141Initial program 82.9%
*-commutative82.9%
Simplified82.9%
add-cube-cbrt82.3%
pow382.3%
*-commutative82.3%
associate-*l*82.3%
Applied egg-rr82.3%
Taylor expanded in a around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt73.1%
rem-cube-cbrt73.4%
distribute-lft-neg-in73.4%
metadata-eval73.4%
*-lft-identity73.4%
associate-*r*73.4%
*-commutative73.4%
*-commutative73.4%
Simplified73.4%
if 1.49999999999999992e-141 < b Initial program 19.1%
*-commutative19.1%
+-commutative19.1%
unsub-neg19.1%
fmm-def19.1%
*-commutative19.1%
associate-*r*19.1%
distribute-lft-neg-in19.1%
*-commutative19.1%
distribute-rgt-neg-in19.1%
associate-*r*19.1%
metadata-eval19.1%
Simplified19.1%
Taylor expanded in b around inf 81.6%
mul-1-neg81.6%
distribute-neg-frac281.6%
Simplified81.6%
Final simplification80.7%
(FPCore (a b c) :precision binary64 (if (<= b -8.6e-64) (/ b (- a)) (if (<= b 1.5e-141) (/ (sqrt (* (* a c) -4.0)) (* a 2.0)) (/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -8.6e-64) {
tmp = b / -a;
} else if (b <= 1.5e-141) {
tmp = 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 <= (-8.6d-64)) then
tmp = b / -a
else if (b <= 1.5d-141) then
tmp = 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 <= -8.6e-64) {
tmp = b / -a;
} else if (b <= 1.5e-141) {
tmp = Math.sqrt(((a * c) * -4.0)) / (a * 2.0);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -8.6e-64: tmp = b / -a elif b <= 1.5e-141: tmp = 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 <= -8.6e-64) tmp = Float64(b / Float64(-a)); elseif (b <= 1.5e-141) tmp = Float64(sqrt(Float64(Float64(a * c) * -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 <= -8.6e-64) tmp = b / -a; elseif (b <= 1.5e-141) tmp = sqrt(((a * c) * -4.0)) / (a * 2.0); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -8.6e-64], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, 1.5e-141], N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -4.0), $MachinePrecision]], $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8.6 \cdot 10^{-64}:\\
\;\;\;\;\frac{b}{-a}\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{-141}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot c\right) \cdot -4}}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -8.59999999999999947e-64Initial program 66.5%
*-commutative66.5%
+-commutative66.5%
unsub-neg66.5%
fmm-def66.5%
*-commutative66.5%
associate-*r*66.5%
distribute-lft-neg-in66.5%
*-commutative66.5%
distribute-rgt-neg-in66.5%
associate-*r*65.5%
metadata-eval65.5%
Simplified65.5%
Taylor expanded in b around -inf 83.9%
associate-*r/83.9%
mul-1-neg83.9%
Simplified83.9%
if -8.59999999999999947e-64 < b < 1.49999999999999992e-141Initial program 82.9%
*-commutative82.9%
Simplified82.9%
add-cube-cbrt82.3%
pow382.3%
*-commutative82.3%
associate-*l*82.3%
Applied egg-rr82.3%
Taylor expanded in a around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt73.1%
rem-cube-cbrt73.4%
distribute-lft-neg-in73.4%
metadata-eval73.4%
*-lft-identity73.4%
associate-*r*73.4%
*-commutative73.4%
*-commutative73.4%
Simplified73.4%
if 1.49999999999999992e-141 < b Initial program 19.1%
*-commutative19.1%
+-commutative19.1%
unsub-neg19.1%
fmm-def19.1%
*-commutative19.1%
associate-*r*19.1%
distribute-lft-neg-in19.1%
*-commutative19.1%
distribute-rgt-neg-in19.1%
associate-*r*19.1%
metadata-eval19.1%
Simplified19.1%
Taylor expanded in b around inf 81.6%
mul-1-neg81.6%
distribute-neg-frac281.6%
Simplified81.6%
Final simplification80.4%
(FPCore (a b c) :precision binary64 (if (<= b -4.9e-160) (/ b (- a)) (if (<= b 4.6e-155) (* -0.5 (sqrt (* c (/ -4.0 a)))) (/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.9e-160) {
tmp = b / -a;
} else if (b <= 4.6e-155) {
tmp = -0.5 * sqrt((c * (-4.0 / 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 <= (-4.9d-160)) then
tmp = b / -a
else if (b <= 4.6d-155) then
tmp = (-0.5d0) * sqrt((c * ((-4.0d0) / 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 <= -4.9e-160) {
tmp = b / -a;
} else if (b <= 4.6e-155) {
tmp = -0.5 * Math.sqrt((c * (-4.0 / a)));
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.9e-160: tmp = b / -a elif b <= 4.6e-155: tmp = -0.5 * math.sqrt((c * (-4.0 / a))) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.9e-160) tmp = Float64(b / Float64(-a)); elseif (b <= 4.6e-155) tmp = Float64(-0.5 * sqrt(Float64(c * Float64(-4.0 / a)))); else tmp = Float64(Float64(-c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.9e-160) tmp = b / -a; elseif (b <= 4.6e-155) tmp = -0.5 * sqrt((c * (-4.0 / a))); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.9e-160], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, 4.6e-155], N[(-0.5 * N[Sqrt[N[(c * N[(-4.0 / a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.9 \cdot 10^{-160}:\\
\;\;\;\;\frac{b}{-a}\\
\mathbf{elif}\;b \leq 4.6 \cdot 10^{-155}:\\
\;\;\;\;-0.5 \cdot \sqrt{c \cdot \frac{-4}{a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -4.8999999999999999e-160Initial program 70.7%
*-commutative70.7%
+-commutative70.7%
unsub-neg70.7%
fmm-def70.7%
*-commutative70.7%
associate-*r*70.7%
distribute-lft-neg-in70.7%
*-commutative70.7%
distribute-rgt-neg-in70.7%
associate-*r*69.9%
metadata-eval69.9%
Simplified69.9%
Taylor expanded in b around -inf 76.8%
associate-*r/76.8%
mul-1-neg76.8%
Simplified76.8%
if -4.8999999999999999e-160 < b < 4.60000000000000011e-155Initial program 80.0%
*-commutative80.0%
Simplified80.0%
add-cube-cbrt79.3%
pow379.2%
*-commutative79.2%
associate-*l*79.2%
Applied egg-rr79.2%
Taylor expanded in a around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt35.7%
rem-cube-cbrt36.0%
associate-/l*35.9%
Simplified35.9%
add-sqr-sqrt0.8%
sqrt-unprod39.6%
mul-1-neg39.6%
mul-1-neg39.6%
sqr-neg39.6%
add-sqr-sqrt39.6%
Applied egg-rr39.6%
if 4.60000000000000011e-155 < b Initial program 20.6%
*-commutative20.6%
+-commutative20.6%
unsub-neg20.6%
fmm-def20.6%
*-commutative20.6%
associate-*r*20.6%
distribute-lft-neg-in20.6%
*-commutative20.6%
distribute-rgt-neg-in20.6%
associate-*r*20.6%
metadata-eval20.6%
Simplified20.6%
Taylor expanded in b around inf 80.3%
mul-1-neg80.3%
distribute-neg-frac280.3%
Simplified80.3%
Final simplification71.7%
(FPCore (a b c) :precision binary64 (if (<= b -5.5e-160) (/ b (- a)) (if (<= b 6.5e-154) (* (sqrt (* -4.0 (/ c a))) -0.5) (/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.5e-160) {
tmp = b / -a;
} else if (b <= 6.5e-154) {
tmp = sqrt((-4.0 * (c / a))) * -0.5;
} 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 <= (-5.5d-160)) then
tmp = b / -a
else if (b <= 6.5d-154) then
tmp = sqrt(((-4.0d0) * (c / a))) * (-0.5d0)
else
tmp = -c / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5.5e-160) {
tmp = b / -a;
} else if (b <= 6.5e-154) {
tmp = Math.sqrt((-4.0 * (c / a))) * -0.5;
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.5e-160: tmp = b / -a elif b <= 6.5e-154: tmp = math.sqrt((-4.0 * (c / a))) * -0.5 else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.5e-160) tmp = Float64(b / Float64(-a)); elseif (b <= 6.5e-154) tmp = Float64(sqrt(Float64(-4.0 * Float64(c / a))) * -0.5); else tmp = Float64(Float64(-c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5.5e-160) tmp = b / -a; elseif (b <= 6.5e-154) tmp = sqrt((-4.0 * (c / a))) * -0.5; else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.5e-160], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, 6.5e-154], N[(N[Sqrt[N[(-4.0 * N[(c / a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.5), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.5 \cdot 10^{-160}:\\
\;\;\;\;\frac{b}{-a}\\
\mathbf{elif}\;b \leq 6.5 \cdot 10^{-154}:\\
\;\;\;\;\sqrt{-4 \cdot \frac{c}{a}} \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -5.5e-160Initial program 70.7%
*-commutative70.7%
+-commutative70.7%
unsub-neg70.7%
fmm-def70.7%
*-commutative70.7%
associate-*r*70.7%
distribute-lft-neg-in70.7%
*-commutative70.7%
distribute-rgt-neg-in70.7%
associate-*r*69.9%
metadata-eval69.9%
Simplified69.9%
Taylor expanded in b around -inf 76.8%
associate-*r/76.8%
mul-1-neg76.8%
Simplified76.8%
if -5.5e-160 < b < 6.5000000000000003e-154Initial program 80.0%
*-commutative80.0%
Simplified80.0%
add-cube-cbrt79.3%
pow379.2%
*-commutative79.2%
associate-*l*79.2%
Applied egg-rr79.2%
Taylor expanded in a around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt35.7%
rem-cube-cbrt36.0%
associate-/l*35.9%
Simplified35.9%
mul-1-neg35.9%
distribute-rgt-neg-out35.9%
add-sqr-sqrt35.9%
sqr-neg35.9%
mul-1-neg35.9%
mul-1-neg35.9%
sqrt-unprod0.8%
add-sqr-sqrt39.6%
associate-*r*39.6%
metadata-eval39.6%
Applied egg-rr39.6%
distribute-lft-neg-in39.6%
metadata-eval39.6%
associate-*r/39.6%
*-commutative39.6%
associate-*r/39.5%
Simplified39.5%
if 6.5000000000000003e-154 < b Initial program 20.6%
*-commutative20.6%
+-commutative20.6%
unsub-neg20.6%
fmm-def20.6%
*-commutative20.6%
associate-*r*20.6%
distribute-lft-neg-in20.6%
*-commutative20.6%
distribute-rgt-neg-in20.6%
associate-*r*20.6%
metadata-eval20.6%
Simplified20.6%
Taylor expanded in b around inf 80.3%
mul-1-neg80.3%
distribute-neg-frac280.3%
Simplified80.3%
Final simplification71.7%
(FPCore (a b c) :precision binary64 (if (<= b 1.28e-304) (/ b (- a)) (/ (- c) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.28e-304) {
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.28d-304) 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.28e-304) {
tmp = b / -a;
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.28e-304: tmp = b / -a else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.28e-304) tmp = Float64(b / Float64(-a)); else tmp = Float64(Float64(-c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.28e-304) tmp = b / -a; else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.28e-304], N[(b / (-a)), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.28 \cdot 10^{-304}:\\
\;\;\;\;\frac{b}{-a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < 1.28000000000000004e-304Initial program 73.2%
*-commutative73.2%
+-commutative73.2%
unsub-neg73.2%
fmm-def73.2%
*-commutative73.2%
associate-*r*73.2%
distribute-lft-neg-in73.2%
*-commutative73.2%
distribute-rgt-neg-in73.2%
associate-*r*72.5%
metadata-eval72.5%
Simplified72.5%
Taylor expanded in b around -inf 64.1%
associate-*r/64.1%
mul-1-neg64.1%
Simplified64.1%
if 1.28000000000000004e-304 < b Initial program 29.4%
*-commutative29.4%
+-commutative29.4%
unsub-neg29.4%
fmm-def29.5%
*-commutative29.5%
associate-*r*29.5%
distribute-lft-neg-in29.5%
*-commutative29.5%
distribute-rgt-neg-in29.5%
associate-*r*29.5%
metadata-eval29.5%
Simplified29.5%
Taylor expanded in b around inf 67.9%
mul-1-neg67.9%
distribute-neg-frac267.9%
Simplified67.9%
Final simplification65.8%
(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(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 53.5%
*-commutative53.5%
+-commutative53.5%
unsub-neg53.5%
fmm-def53.5%
*-commutative53.5%
associate-*r*53.5%
distribute-lft-neg-in53.5%
*-commutative53.5%
distribute-rgt-neg-in53.5%
associate-*r*53.1%
metadata-eval53.1%
Simplified53.1%
Taylor expanded in b around inf 31.8%
mul-1-neg31.8%
distribute-neg-frac231.8%
Simplified31.8%
Final simplification31.8%
(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 53.5%
*-commutative53.5%
+-commutative53.5%
unsub-neg53.5%
fmm-def53.5%
*-commutative53.5%
associate-*r*53.5%
distribute-lft-neg-in53.5%
*-commutative53.5%
distribute-rgt-neg-in53.5%
associate-*r*53.1%
metadata-eval53.1%
Simplified53.1%
Taylor expanded in b around inf 31.8%
mul-1-neg31.8%
distribute-neg-frac231.8%
Simplified31.8%
div-inv31.7%
add-sqr-sqrt1.3%
sqrt-unprod8.9%
sqr-neg8.9%
sqrt-prod7.6%
add-sqr-sqrt9.7%
Applied egg-rr9.7%
associate-*r/9.7%
*-rgt-identity9.7%
Simplified9.7%
(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 53.5%
*-commutative53.5%
+-commutative53.5%
unsub-neg53.5%
fmm-def53.5%
*-commutative53.5%
associate-*r*53.5%
distribute-lft-neg-in53.5%
*-commutative53.5%
distribute-rgt-neg-in53.5%
associate-*r*53.1%
metadata-eval53.1%
Simplified53.1%
div-sub52.6%
sub-neg52.6%
div-inv52.5%
fma-undefine52.5%
add-sqr-sqrt44.7%
hypot-define51.4%
associate-*r*51.7%
*-commutative51.7%
*-commutative51.7%
associate-/r*51.7%
metadata-eval51.7%
div-inv52.1%
*-commutative52.1%
associate-/r*52.1%
metadata-eval52.1%
Applied egg-rr52.1%
sub-neg52.1%
distribute-rgt-out--54.6%
Simplified54.6%
sub-neg54.6%
add-sqr-sqrt37.1%
sqrt-unprod44.9%
sqr-neg44.9%
sqrt-prod12.1%
add-sqr-sqrt28.3%
Applied egg-rr28.3%
Taylor expanded in a around 0 2.5%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fabs (/ b 2.0)))
(t_1 (* (sqrt (fabs a)) (sqrt (fabs c))))
(t_2
(if (== (copysign a c) a)
(* (sqrt (- t_0 t_1)) (sqrt (+ t_0 t_1)))
(hypot (/ b 2.0) t_1))))
(if (< b 0.0) (/ (- t_2 (/ b 2.0)) a) (/ (- c) (+ (/ b 2.0) t_2)))))
double code(double a, double b, double c) {
double t_0 = fabs((b / 2.0));
double t_1 = sqrt(fabs(a)) * sqrt(fabs(c));
double tmp;
if (copysign(a, c) == a) {
tmp = sqrt((t_0 - t_1)) * sqrt((t_0 + t_1));
} else {
tmp = hypot((b / 2.0), t_1);
}
double t_2 = tmp;
double tmp_1;
if (b < 0.0) {
tmp_1 = (t_2 - (b / 2.0)) / a;
} else {
tmp_1 = -c / ((b / 2.0) + t_2);
}
return tmp_1;
}
public static double code(double a, double b, double c) {
double t_0 = Math.abs((b / 2.0));
double t_1 = Math.sqrt(Math.abs(a)) * Math.sqrt(Math.abs(c));
double tmp;
if (Math.copySign(a, c) == a) {
tmp = Math.sqrt((t_0 - t_1)) * Math.sqrt((t_0 + t_1));
} else {
tmp = Math.hypot((b / 2.0), t_1);
}
double t_2 = tmp;
double tmp_1;
if (b < 0.0) {
tmp_1 = (t_2 - (b / 2.0)) / a;
} else {
tmp_1 = -c / ((b / 2.0) + t_2);
}
return tmp_1;
}
def code(a, b, c): t_0 = math.fabs((b / 2.0)) t_1 = math.sqrt(math.fabs(a)) * math.sqrt(math.fabs(c)) tmp = 0 if math.copysign(a, c) == a: tmp = math.sqrt((t_0 - t_1)) * math.sqrt((t_0 + t_1)) else: tmp = math.hypot((b / 2.0), t_1) t_2 = tmp tmp_1 = 0 if b < 0.0: tmp_1 = (t_2 - (b / 2.0)) / a else: tmp_1 = -c / ((b / 2.0) + t_2) return tmp_1
function code(a, b, c) t_0 = abs(Float64(b / 2.0)) t_1 = Float64(sqrt(abs(a)) * sqrt(abs(c))) tmp = 0.0 if (copysign(a, c) == a) tmp = Float64(sqrt(Float64(t_0 - t_1)) * sqrt(Float64(t_0 + t_1))); else tmp = hypot(Float64(b / 2.0), t_1); end t_2 = tmp tmp_1 = 0.0 if (b < 0.0) tmp_1 = Float64(Float64(t_2 - Float64(b / 2.0)) / a); else tmp_1 = Float64(Float64(-c) / Float64(Float64(b / 2.0) + t_2)); end return tmp_1 end
function tmp_3 = code(a, b, c) t_0 = abs((b / 2.0)); t_1 = sqrt(abs(a)) * sqrt(abs(c)); tmp = 0.0; if ((sign(c) * abs(a)) == a) tmp = sqrt((t_0 - t_1)) * sqrt((t_0 + t_1)); else tmp = hypot((b / 2.0), t_1); end t_2 = tmp; tmp_2 = 0.0; if (b < 0.0) tmp_2 = (t_2 - (b / 2.0)) / a; else tmp_2 = -c / ((b / 2.0) + t_2); end tmp_3 = tmp_2; end
code[a_, b_, c_] := Block[{t$95$0 = N[Abs[N[(b / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[Abs[a], $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[Abs[c], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = If[Equal[N[With[{TMP1 = Abs[a], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], a], N[(N[Sqrt[N[(t$95$0 - t$95$1), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$0 + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(b / 2.0), $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]]}, If[Less[b, 0.0], N[(N[(t$95$2 - N[(b / 2.0), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[((-c) / N[(N[(b / 2.0), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{b}{2}\right|\\
t_1 := \sqrt{\left|a\right|} \cdot \sqrt{\left|c\right|}\\
t_2 := \begin{array}{l}
\mathbf{if}\;\mathsf{copysign}\left(a, c\right) = a:\\
\;\;\;\;\sqrt{t\_0 - t\_1} \cdot \sqrt{t\_0 + t\_1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(\frac{b}{2}, t\_1\right)\\
\end{array}\\
\mathbf{if}\;b < 0:\\
\;\;\;\;\frac{t\_2 - \frac{b}{2}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{\frac{b}{2} + t\_2}\\
\end{array}
\end{array}
herbie shell --seed 2024166
(FPCore (a b c)
:name "quadp (p42, positive)"
:precision binary64
:herbie-expected 10
:alt
(! :herbie-platform default (let ((sqtD (let ((x (* (sqrt (fabs a)) (sqrt (fabs c))))) (if (== (copysign a c) a) (* (sqrt (- (fabs (/ b 2)) x)) (sqrt (+ (fabs (/ b 2)) x))) (hypot (/ b 2) x))))) (if (< b 0) (/ (- sqtD (/ b 2)) a) (/ (- c) (+ (/ b 2) sqtD)))))
(/ (+ (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))