
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.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) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.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) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
(FPCore (a b c)
:precision binary64
(if (<= b -1e+76)
(/ (+ (* b -2.0) (* (/ c b) (* a 1.5))) (* a 3.0))
(if (<= b 8e-43)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e+76) {
tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0);
} else if (b <= 8e-43) {
tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / 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+76)) then
tmp = ((b * (-2.0d0)) + ((c / b) * (a * 1.5d0))) / (a * 3.0d0)
else if (b <= 8d-43) then
tmp = (sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e+76) {
tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0);
} else if (b <= 8e-43) {
tmp = (Math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e+76: tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0) elif b <= 8e-43: tmp = (math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e+76) tmp = Float64(Float64(Float64(b * -2.0) + Float64(Float64(c / b) * Float64(a * 1.5))) / Float64(a * 3.0)); elseif (b <= 8e-43) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e+76) tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0); elseif (b <= 8e-43) tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e+76], N[(N[(N[(b * -2.0), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * N[(a * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8e-43], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{+76}:\\
\;\;\;\;\frac{b \cdot -2 + \frac{c}{b} \cdot \left(a \cdot 1.5\right)}{a \cdot 3}\\
\mathbf{elif}\;b \leq 8 \cdot 10^{-43}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1e76Initial program 62.1%
sqr-neg62.1%
sqr-neg62.1%
associate-*l*62.1%
Simplified62.1%
Taylor expanded in b around -inf 88.0%
associate-*r/88.0%
Applied egg-rr88.0%
associate-/l*88.0%
associate-*r/95.6%
*-commutative95.6%
*-commutative95.6%
associate-*l*95.6%
Simplified95.6%
if -1e76 < b < 8.00000000000000062e-43Initial program 88.6%
if 8.00000000000000062e-43 < b Initial program 15.7%
sqr-neg15.7%
sqr-neg15.7%
associate-*l*15.6%
Simplified15.6%
Taylor expanded in b around inf 90.0%
*-commutative90.0%
associate-*l/90.0%
Simplified90.0%
Final simplification90.9%
(FPCore (a b c)
:precision binary64
(if (<= b -3.1e+72)
(/ (+ (* b -2.0) (* (/ c b) (* a 1.5))) (* a 3.0))
(if (<= b 5.1e-34)
(/ (- (sqrt (- (* b b) (* 3.0 (* c a)))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.1e+72) {
tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0);
} else if (b <= 5.1e-34) {
tmp = (sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / 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 <= (-3.1d+72)) then
tmp = ((b * (-2.0d0)) + ((c / b) * (a * 1.5d0))) / (a * 3.0d0)
else if (b <= 5.1d-34) then
tmp = (sqrt(((b * b) - (3.0d0 * (c * a)))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -3.1e+72) {
tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0);
} else if (b <= 5.1e-34) {
tmp = (Math.sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.1e+72: tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0) elif b <= 5.1e-34: tmp = (math.sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.1e+72) tmp = Float64(Float64(Float64(b * -2.0) + Float64(Float64(c / b) * Float64(a * 1.5))) / Float64(a * 3.0)); elseif (b <= 5.1e-34) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(c * a)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.1e+72) tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0); elseif (b <= 5.1e-34) tmp = (sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.1e+72], N[(N[(N[(b * -2.0), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * N[(a * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.1e-34], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.1 \cdot 10^{+72}:\\
\;\;\;\;\frac{b \cdot -2 + \frac{c}{b} \cdot \left(a \cdot 1.5\right)}{a \cdot 3}\\
\mathbf{elif}\;b \leq 5.1 \cdot 10^{-34}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3.09999999999999988e72Initial program 62.1%
sqr-neg62.1%
sqr-neg62.1%
associate-*l*62.1%
Simplified62.1%
Taylor expanded in b around -inf 88.0%
associate-*r/88.0%
Applied egg-rr88.0%
associate-/l*88.0%
associate-*r/95.6%
*-commutative95.6%
*-commutative95.6%
associate-*l*95.6%
Simplified95.6%
if -3.09999999999999988e72 < b < 5.1000000000000001e-34Initial program 88.6%
sqr-neg88.6%
sqr-neg88.6%
associate-*l*88.4%
Simplified88.4%
if 5.1000000000000001e-34 < b Initial program 15.7%
sqr-neg15.7%
sqr-neg15.7%
associate-*l*15.6%
Simplified15.6%
Taylor expanded in b around inf 90.0%
*-commutative90.0%
associate-*l/90.0%
Simplified90.0%
Final simplification90.8%
(FPCore (a b c)
:precision binary64
(if (<= b -2.9e-127)
(/ (+ (* b -2.0) (* (/ c b) (* a 1.5))) (* a 3.0))
(if (<= b 1.36e-40)
(* 0.3333333333333333 (/ (+ b (sqrt (* a (* c -3.0)))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.9e-127) {
tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0);
} else if (b <= 1.36e-40) {
tmp = 0.3333333333333333 * ((b + sqrt((a * (c * -3.0)))) / a);
} else {
tmp = (c * -0.5) / 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 <= (-2.9d-127)) then
tmp = ((b * (-2.0d0)) + ((c / b) * (a * 1.5d0))) / (a * 3.0d0)
else if (b <= 1.36d-40) then
tmp = 0.3333333333333333d0 * ((b + sqrt((a * (c * (-3.0d0))))) / a)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.9e-127) {
tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0);
} else if (b <= 1.36e-40) {
tmp = 0.3333333333333333 * ((b + Math.sqrt((a * (c * -3.0)))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.9e-127: tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0) elif b <= 1.36e-40: tmp = 0.3333333333333333 * ((b + math.sqrt((a * (c * -3.0)))) / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.9e-127) tmp = Float64(Float64(Float64(b * -2.0) + Float64(Float64(c / b) * Float64(a * 1.5))) / Float64(a * 3.0)); elseif (b <= 1.36e-40) tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(a * Float64(c * -3.0)))) / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.9e-127) tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0); elseif (b <= 1.36e-40) tmp = 0.3333333333333333 * ((b + sqrt((a * (c * -3.0)))) / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.9e-127], N[(N[(N[(b * -2.0), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * N[(a * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.36e-40], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.9 \cdot 10^{-127}:\\
\;\;\;\;\frac{b \cdot -2 + \frac{c}{b} \cdot \left(a \cdot 1.5\right)}{a \cdot 3}\\
\mathbf{elif}\;b \leq 1.36 \cdot 10^{-40}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.9e-127Initial program 74.3%
sqr-neg74.3%
sqr-neg74.3%
associate-*l*74.3%
Simplified74.3%
Taylor expanded in b around -inf 82.3%
associate-*r/82.3%
Applied egg-rr82.3%
associate-/l*82.3%
associate-*r/87.4%
*-commutative87.4%
*-commutative87.4%
associate-*l*87.4%
Simplified87.4%
if -2.9e-127 < b < 1.3599999999999999e-40Initial program 83.5%
sqr-neg83.5%
sqr-neg83.5%
associate-*l*83.2%
Simplified83.2%
Taylor expanded in b around 0 82.7%
*-commutative82.7%
associate-*r*82.9%
Simplified82.9%
*-un-lft-identity82.9%
times-frac83.0%
metadata-eval83.0%
+-commutative83.0%
add-sqr-sqrt41.8%
sqrt-unprod82.8%
sqr-neg82.8%
sqrt-unprod41.2%
add-sqr-sqrt82.8%
Applied egg-rr82.8%
if 1.3599999999999999e-40 < b Initial program 15.7%
sqr-neg15.7%
sqr-neg15.7%
associate-*l*15.6%
Simplified15.6%
Taylor expanded in b around inf 90.0%
*-commutative90.0%
associate-*l/90.0%
Simplified90.0%
Final simplification87.1%
(FPCore (a b c)
:precision binary64
(if (<= b -9.2e-128)
(/ (+ (* b -2.0) (* (/ c b) (* a 1.5))) (* a 3.0))
(if (<= b 8e-43)
(* (- b (sqrt (* c (* a -3.0)))) (/ -0.3333333333333333 a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -9.2e-128) {
tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0);
} else if (b <= 8e-43) {
tmp = (b - sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / a);
} else {
tmp = (c * -0.5) / 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.2d-128)) then
tmp = ((b * (-2.0d0)) + ((c / b) * (a * 1.5d0))) / (a * 3.0d0)
else if (b <= 8d-43) then
tmp = (b - sqrt((c * (a * (-3.0d0))))) * ((-0.3333333333333333d0) / a)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -9.2e-128) {
tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0);
} else if (b <= 8e-43) {
tmp = (b - Math.sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -9.2e-128: tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0) elif b <= 8e-43: tmp = (b - math.sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -9.2e-128) tmp = Float64(Float64(Float64(b * -2.0) + Float64(Float64(c / b) * Float64(a * 1.5))) / Float64(a * 3.0)); elseif (b <= 8e-43) tmp = Float64(Float64(b - sqrt(Float64(c * Float64(a * -3.0)))) * Float64(-0.3333333333333333 / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -9.2e-128) tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0); elseif (b <= 8e-43) tmp = (b - sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -9.2e-128], N[(N[(N[(b * -2.0), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * N[(a * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8e-43], N[(N[(b - N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -9.2 \cdot 10^{-128}:\\
\;\;\;\;\frac{b \cdot -2 + \frac{c}{b} \cdot \left(a \cdot 1.5\right)}{a \cdot 3}\\
\mathbf{elif}\;b \leq 8 \cdot 10^{-43}:\\
\;\;\;\;\left(b - \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{-0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -9.2000000000000003e-128Initial program 74.3%
sqr-neg74.3%
sqr-neg74.3%
associate-*l*74.3%
Simplified74.3%
Taylor expanded in b around -inf 82.3%
associate-*r/82.3%
Applied egg-rr82.3%
associate-/l*82.3%
associate-*r/87.4%
*-commutative87.4%
*-commutative87.4%
associate-*l*87.4%
Simplified87.4%
if -9.2000000000000003e-128 < b < 8.00000000000000062e-43Initial program 83.5%
sqr-neg83.5%
sqr-neg83.5%
associate-*l*83.2%
Simplified83.2%
Taylor expanded in b around 0 82.7%
*-un-lft-identity82.7%
*-commutative82.7%
Applied egg-rr83.1%
associate-*l/83.1%
associate-*r/83.2%
*-commutative83.2%
associate-/r*82.9%
metadata-eval82.9%
Simplified82.9%
if 8.00000000000000062e-43 < b Initial program 15.7%
sqr-neg15.7%
sqr-neg15.7%
associate-*l*15.6%
Simplified15.6%
Taylor expanded in b around inf 90.0%
*-commutative90.0%
associate-*l/90.0%
Simplified90.0%
Final simplification87.2%
(FPCore (a b c)
:precision binary64
(if (<= b -2.9e-127)
(/ (+ (* b -2.0) (* (/ c b) (* a 1.5))) (* a 3.0))
(if (<= b 7.8e-43)
(/ (- (sqrt (* a (* c -3.0))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.9e-127) {
tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0);
} else if (b <= 7.8e-43) {
tmp = (sqrt((a * (c * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / 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 <= (-2.9d-127)) then
tmp = ((b * (-2.0d0)) + ((c / b) * (a * 1.5d0))) / (a * 3.0d0)
else if (b <= 7.8d-43) then
tmp = (sqrt((a * (c * (-3.0d0)))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.9e-127) {
tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0);
} else if (b <= 7.8e-43) {
tmp = (Math.sqrt((a * (c * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.9e-127: tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0) elif b <= 7.8e-43: tmp = (math.sqrt((a * (c * -3.0))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.9e-127) tmp = Float64(Float64(Float64(b * -2.0) + Float64(Float64(c / b) * Float64(a * 1.5))) / Float64(a * 3.0)); elseif (b <= 7.8e-43) tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.9e-127) tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0); elseif (b <= 7.8e-43) tmp = (sqrt((a * (c * -3.0))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.9e-127], N[(N[(N[(b * -2.0), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * N[(a * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.8e-43], N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.9 \cdot 10^{-127}:\\
\;\;\;\;\frac{b \cdot -2 + \frac{c}{b} \cdot \left(a \cdot 1.5\right)}{a \cdot 3}\\
\mathbf{elif}\;b \leq 7.8 \cdot 10^{-43}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.9e-127Initial program 74.3%
sqr-neg74.3%
sqr-neg74.3%
associate-*l*74.3%
Simplified74.3%
Taylor expanded in b around -inf 82.3%
associate-*r/82.3%
Applied egg-rr82.3%
associate-/l*82.3%
associate-*r/87.4%
*-commutative87.4%
*-commutative87.4%
associate-*l*87.4%
Simplified87.4%
if -2.9e-127 < b < 7.80000000000000001e-43Initial program 83.5%
sqr-neg83.5%
sqr-neg83.5%
associate-*l*83.2%
Simplified83.2%
Taylor expanded in b around 0 82.7%
*-commutative82.7%
associate-*r*82.9%
Simplified82.9%
if 7.80000000000000001e-43 < b Initial program 15.7%
sqr-neg15.7%
sqr-neg15.7%
associate-*l*15.6%
Simplified15.6%
Taylor expanded in b around inf 90.0%
*-commutative90.0%
associate-*l/90.0%
Simplified90.0%
Final simplification87.2%
(FPCore (a b c) :precision binary64 (if (<= b -1e-310) (/ (+ (* b -2.0) (* (/ c b) (* a 1.5))) (* a 3.0)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0);
} else {
tmp = (c * -0.5) / 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 = ((b * (-2.0d0)) + ((c / b) * (a * 1.5d0))) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-310: tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-310) tmp = Float64(Float64(Float64(b * -2.0) + Float64(Float64(c / b) * Float64(a * 1.5))) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-310) tmp = ((b * -2.0) + ((c / b) * (a * 1.5))) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-310], N[(N[(N[(b * -2.0), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * N[(a * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{b \cdot -2 + \frac{c}{b} \cdot \left(a \cdot 1.5\right)}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 78.4%
sqr-neg78.4%
sqr-neg78.4%
associate-*l*78.3%
Simplified78.3%
Taylor expanded in b around -inf 64.1%
associate-*r/64.1%
Applied egg-rr64.1%
associate-/l*64.1%
associate-*r/68.3%
*-commutative68.3%
*-commutative68.3%
associate-*l*68.3%
Simplified68.3%
if -9.999999999999969e-311 < b Initial program 33.5%
sqr-neg33.5%
sqr-neg33.5%
associate-*l*33.5%
Simplified33.5%
Taylor expanded in b around inf 69.0%
*-commutative69.0%
associate-*l/69.0%
Simplified69.0%
Final simplification68.7%
(FPCore (a b c) :precision binary64 (if (<= b -1e-310) (+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else {
tmp = (c * -0.5) / 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 = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-310: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-310) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-310) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-310], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 78.4%
sqr-neg78.4%
sqr-neg78.4%
associate-*l*78.3%
Simplified78.3%
Taylor expanded in b around -inf 68.2%
if -9.999999999999969e-311 < b Initial program 33.5%
sqr-neg33.5%
sqr-neg33.5%
associate-*l*33.5%
Simplified33.5%
Taylor expanded in b around inf 69.0%
*-commutative69.0%
associate-*l/69.0%
Simplified69.0%
Final simplification68.6%
(FPCore (a b c) :precision binary64 (if (<= b 5.1e-245) (/ (/ (* b 2.0) a) -3.0) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
tmp = ((b * 2.0) / a) / -3.0;
} else {
tmp = (c * -0.5) / 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.1d-245) then
tmp = ((b * 2.0d0) / a) / (-3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
tmp = ((b * 2.0) / a) / -3.0;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5.1e-245: tmp = ((b * 2.0) / a) / -3.0 else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 5.1e-245) tmp = Float64(Float64(Float64(b * 2.0) / a) / -3.0); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 5.1e-245) tmp = ((b * 2.0) / a) / -3.0; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 5.1e-245], N[(N[(N[(b * 2.0), $MachinePrecision] / a), $MachinePrecision] / -3.0), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.1 \cdot 10^{-245}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{a}}{-3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 5.1000000000000003e-245Initial program 78.9%
sqr-neg78.9%
sqr-neg78.9%
associate-*l*78.8%
Simplified78.8%
Applied egg-rr66.6%
associate-/r*66.6%
Simplified66.6%
associate-*r/66.5%
Applied egg-rr66.5%
Taylor expanded in b around -inf 66.3%
associate-*r/66.3%
Simplified66.3%
if 5.1000000000000003e-245 < b Initial program 31.9%
sqr-neg31.9%
sqr-neg31.9%
associate-*l*31.8%
Simplified31.8%
Taylor expanded in b around inf 70.6%
*-commutative70.6%
associate-*l/70.6%
Simplified70.6%
Final simplification68.4%
(FPCore (a b c) :precision binary64 (if (<= b 1.3e+18) (* b (/ -0.6666666666666666 a)) (* (/ c b) 0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.3e+18) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c / b) * 0.5;
}
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+18) then
tmp = b * ((-0.6666666666666666d0) / a)
else
tmp = (c / b) * 0.5d0
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.3e+18) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c / b) * 0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.3e+18: tmp = b * (-0.6666666666666666 / a) else: tmp = (c / b) * 0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.3e+18) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(Float64(c / b) * 0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.3e+18) tmp = b * (-0.6666666666666666 / a); else tmp = (c / b) * 0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.3e+18], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.3 \cdot 10^{+18}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot 0.5\\
\end{array}
\end{array}
if b < 1.3e18Initial program 74.2%
sqr-neg74.2%
sqr-neg74.2%
associate-*l*74.1%
Simplified74.1%
Applied egg-rr65.0%
associate-/r*64.9%
Simplified64.9%
Taylor expanded in b around -inf 48.6%
associate-*r/48.6%
*-commutative48.6%
associate-/l*48.6%
Simplified48.6%
if 1.3e18 < b Initial program 10.9%
sqr-neg10.9%
sqr-neg10.9%
associate-*l*10.9%
Simplified10.9%
Taylor expanded in b around -inf 2.4%
Taylor expanded in b around 0 28.2%
Final simplification42.7%
(FPCore (a b c) :precision binary64 (if (<= b 5.1e-245) (* b (/ -0.6666666666666666 a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = c * (-0.5 / 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.1d-245) then
tmp = b * ((-0.6666666666666666d0) / a)
else
tmp = c * ((-0.5d0) / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5.1e-245: tmp = b * (-0.6666666666666666 / a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 5.1e-245) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(c * Float64(-0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 5.1e-245) tmp = b * (-0.6666666666666666 / a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 5.1e-245], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.1 \cdot 10^{-245}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 5.1000000000000003e-245Initial program 78.9%
sqr-neg78.9%
sqr-neg78.9%
associate-*l*78.8%
Simplified78.8%
Applied egg-rr66.6%
associate-/r*66.6%
Simplified66.6%
Taylor expanded in b around -inf 66.3%
associate-*r/66.3%
*-commutative66.3%
associate-/l*66.3%
Simplified66.3%
if 5.1000000000000003e-245 < b Initial program 31.9%
sqr-neg31.9%
sqr-neg31.9%
associate-*l*31.8%
Simplified31.8%
Taylor expanded in b around inf 52.3%
associate-/l*52.2%
*-un-lft-identity52.2%
times-frac52.3%
metadata-eval52.3%
associate-/l*56.8%
Applied egg-rr56.8%
associate-*r*56.8%
clear-num56.3%
un-div-inv56.3%
metadata-eval56.3%
*-un-lft-identity56.3%
*-commutative56.3%
times-frac69.5%
clear-num69.3%
Applied egg-rr69.3%
*-inverses69.3%
associate-/r*69.3%
/-rgt-identity69.3%
associate-/r/70.4%
Simplified70.4%
Final simplification68.3%
(FPCore (a b c) :precision binary64 (if (<= b 5.1e-245) (* -0.6666666666666666 (/ b a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = c * (-0.5 / 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.1d-245) then
tmp = (-0.6666666666666666d0) * (b / a)
else
tmp = c * ((-0.5d0) / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5.1e-245: tmp = -0.6666666666666666 * (b / a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 5.1e-245) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(c * Float64(-0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 5.1e-245) tmp = -0.6666666666666666 * (b / a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 5.1e-245], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.1 \cdot 10^{-245}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 5.1000000000000003e-245Initial program 78.9%
sqr-neg78.9%
sqr-neg78.9%
associate-*l*78.8%
Simplified78.8%
Taylor expanded in b around -inf 66.3%
*-commutative66.3%
Simplified66.3%
if 5.1000000000000003e-245 < b Initial program 31.9%
sqr-neg31.9%
sqr-neg31.9%
associate-*l*31.8%
Simplified31.8%
Taylor expanded in b around inf 52.3%
associate-/l*52.2%
*-un-lft-identity52.2%
times-frac52.3%
metadata-eval52.3%
associate-/l*56.8%
Applied egg-rr56.8%
associate-*r*56.8%
clear-num56.3%
un-div-inv56.3%
metadata-eval56.3%
*-un-lft-identity56.3%
*-commutative56.3%
times-frac69.5%
clear-num69.3%
Applied egg-rr69.3%
*-inverses69.3%
associate-/r*69.3%
/-rgt-identity69.3%
associate-/r/70.4%
Simplified70.4%
Final simplification68.3%
(FPCore (a b c) :precision binary64 (if (<= b 5.1e-245) (/ b (* a -1.5)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
tmp = b / (a * -1.5);
} else {
tmp = c * (-0.5 / 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.1d-245) then
tmp = b / (a * (-1.5d0))
else
tmp = c * ((-0.5d0) / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
tmp = b / (a * -1.5);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5.1e-245: tmp = b / (a * -1.5) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 5.1e-245) tmp = Float64(b / Float64(a * -1.5)); else tmp = Float64(c * Float64(-0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 5.1e-245) tmp = b / (a * -1.5); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 5.1e-245], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.1 \cdot 10^{-245}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 5.1000000000000003e-245Initial program 78.9%
sqr-neg78.9%
sqr-neg78.9%
associate-*l*78.8%
Simplified78.8%
Applied egg-rr66.6%
associate-/r*66.6%
Simplified66.6%
Taylor expanded in b around -inf 66.3%
associate-*r/66.3%
*-commutative66.3%
associate-/l*66.3%
Simplified66.3%
add-cbrt-cube42.6%
pow1/321.8%
pow321.8%
Applied egg-rr21.8%
unpow1/342.6%
rem-cbrt-cube66.3%
clear-num66.3%
un-div-inv66.3%
div-inv66.3%
metadata-eval66.3%
Applied egg-rr66.3%
if 5.1000000000000003e-245 < b Initial program 31.9%
sqr-neg31.9%
sqr-neg31.9%
associate-*l*31.8%
Simplified31.8%
Taylor expanded in b around inf 52.3%
associate-/l*52.2%
*-un-lft-identity52.2%
times-frac52.3%
metadata-eval52.3%
associate-/l*56.8%
Applied egg-rr56.8%
associate-*r*56.8%
clear-num56.3%
un-div-inv56.3%
metadata-eval56.3%
*-un-lft-identity56.3%
*-commutative56.3%
times-frac69.5%
clear-num69.3%
Applied egg-rr69.3%
*-inverses69.3%
associate-/r*69.3%
/-rgt-identity69.3%
associate-/r/70.4%
Simplified70.4%
Final simplification68.3%
(FPCore (a b c) :precision binary64 (if (<= b 5.1e-245) (/ b (* a -1.5)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
tmp = b / (a * -1.5);
} else {
tmp = (c * -0.5) / 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.1d-245) then
tmp = b / (a * (-1.5d0))
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
tmp = b / (a * -1.5);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5.1e-245: tmp = b / (a * -1.5) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 5.1e-245) tmp = Float64(b / Float64(a * -1.5)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 5.1e-245) tmp = b / (a * -1.5); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 5.1e-245], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.1 \cdot 10^{-245}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 5.1000000000000003e-245Initial program 78.9%
sqr-neg78.9%
sqr-neg78.9%
associate-*l*78.8%
Simplified78.8%
Applied egg-rr66.6%
associate-/r*66.6%
Simplified66.6%
Taylor expanded in b around -inf 66.3%
associate-*r/66.3%
*-commutative66.3%
associate-/l*66.3%
Simplified66.3%
add-cbrt-cube42.6%
pow1/321.8%
pow321.8%
Applied egg-rr21.8%
unpow1/342.6%
rem-cbrt-cube66.3%
clear-num66.3%
un-div-inv66.3%
div-inv66.3%
metadata-eval66.3%
Applied egg-rr66.3%
if 5.1000000000000003e-245 < b Initial program 31.9%
sqr-neg31.9%
sqr-neg31.9%
associate-*l*31.8%
Simplified31.8%
Taylor expanded in b around inf 70.6%
*-commutative70.6%
associate-*l/70.6%
Simplified70.6%
Final simplification68.4%
(FPCore (a b c) :precision binary64 (* (/ c b) 0.5))
double code(double a, double b, double c) {
return (c / b) * 0.5;
}
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) * 0.5d0
end function
public static double code(double a, double b, double c) {
return (c / b) * 0.5;
}
def code(a, b, c): return (c / b) * 0.5
function code(a, b, c) return Float64(Float64(c / b) * 0.5) end
function tmp = code(a, b, c) tmp = (c / b) * 0.5; end
code[a_, b_, c_] := N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{c}{b} \cdot 0.5
\end{array}
Initial program 56.1%
sqr-neg56.1%
sqr-neg56.1%
associate-*l*56.0%
Simplified56.0%
Taylor expanded in b around -inf 33.4%
Taylor expanded in b around 0 10.2%
Final simplification10.2%
herbie shell --seed 2024041
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))