
(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 -5e+120)
(/ (- (- (/ (* 1.5 a) (/ b c)) b) b) (* a 3.0))
(if (<= b 7.2e-60)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e+120) {
tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 7.2e-60) {
tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} else {
tmp = -0.5 * (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+120)) then
tmp = ((((1.5d0 * a) / (b / c)) - b) - b) / (a * 3.0d0)
else if (b <= 7.2d-60) then
tmp = (sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e+120) {
tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 7.2e-60) {
tmp = (Math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e+120: tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0) elif b <= 7.2e-60: tmp = (math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e+120) tmp = Float64(Float64(Float64(Float64(Float64(1.5 * a) / Float64(b / c)) - b) - b) / Float64(a * 3.0)); elseif (b <= 7.2e-60) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e+120) tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0); elseif (b <= 7.2e-60) tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e+120], N[(N[(N[(N[(N[(1.5 * a), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.2e-60], 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[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{+120}:\\
\;\;\;\;\frac{\left(\frac{1.5 \cdot a}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-60}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -5.00000000000000019e120Initial program 45.5%
sqr-neg45.5%
sqr-neg45.5%
associate-*l*45.5%
Simplified45.5%
Taylor expanded in b around -inf 91.8%
+-commutative91.8%
mul-1-neg91.8%
unsub-neg91.8%
associate-/l*97.9%
associate-*r/97.9%
Simplified97.9%
if -5.00000000000000019e120 < b < 7.2e-60Initial program 87.4%
if 7.2e-60 < b Initial program 15.6%
sqr-neg15.6%
sqr-neg15.6%
associate-*l*15.5%
Simplified15.5%
Taylor expanded in b around inf 85.0%
Final simplification88.5%
(FPCore (a b c)
:precision binary64
(if (<= b -5.5e+84)
(/ (- (- (/ (* 1.5 a) (/ b c)) b) b) (* a 3.0))
(if (<= b 2.25e-52)
(* (- (sqrt (- (* b b) (* a (* c 3.0)))) b) (/ 0.3333333333333333 a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.5e+84) {
tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 2.25e-52) {
tmp = (sqrt(((b * b) - (a * (c * 3.0)))) - b) * (0.3333333333333333 / a);
} else {
tmp = -0.5 * (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+84)) then
tmp = ((((1.5d0 * a) / (b / c)) - b) - b) / (a * 3.0d0)
else if (b <= 2.25d-52) then
tmp = (sqrt(((b * b) - (a * (c * 3.0d0)))) - b) * (0.3333333333333333d0 / a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5.5e+84) {
tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 2.25e-52) {
tmp = (Math.sqrt(((b * b) - (a * (c * 3.0)))) - b) * (0.3333333333333333 / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.5e+84: tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0) elif b <= 2.25e-52: tmp = (math.sqrt(((b * b) - (a * (c * 3.0)))) - b) * (0.3333333333333333 / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.5e+84) tmp = Float64(Float64(Float64(Float64(Float64(1.5 * a) / Float64(b / c)) - b) - b) / Float64(a * 3.0)); elseif (b <= 2.25e-52) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(a * Float64(c * 3.0)))) - b) * Float64(0.3333333333333333 / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5.5e+84) tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0); elseif (b <= 2.25e-52) tmp = (sqrt(((b * b) - (a * (c * 3.0)))) - b) * (0.3333333333333333 / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.5e+84], N[(N[(N[(N[(N[(1.5 * a), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.25e-52], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(a * N[(c * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.5 \cdot 10^{+84}:\\
\;\;\;\;\frac{\left(\frac{1.5 \cdot a}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 2.25 \cdot 10^{-52}:\\
\;\;\;\;\left(\sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -5.5000000000000004e84Initial program 55.5%
sqr-neg55.5%
sqr-neg55.5%
associate-*l*55.5%
Simplified55.5%
Taylor expanded in b around -inf 93.2%
+-commutative93.2%
mul-1-neg93.2%
unsub-neg93.2%
associate-/l*98.3%
associate-*r/98.3%
Simplified98.3%
if -5.5000000000000004e84 < b < 2.25e-52Initial program 86.1%
neg-sub086.1%
sqr-neg86.1%
associate-+l-86.1%
sub0-neg86.1%
neg-mul-186.1%
Simplified85.9%
associate-*r*85.8%
metadata-eval85.8%
distribute-rgt-neg-in85.8%
*-commutative85.8%
fma-neg85.8%
associate-*r*85.9%
*-commutative85.9%
associate-*l*85.9%
Applied egg-rr85.9%
*-commutative85.9%
Simplified85.9%
div-inv85.8%
clear-num85.8%
Applied egg-rr85.8%
if 2.25e-52 < b Initial program 15.6%
sqr-neg15.6%
sqr-neg15.6%
associate-*l*15.5%
Simplified15.5%
Taylor expanded in b around inf 85.0%
Final simplification88.4%
(FPCore (a b c)
:precision binary64
(if (<= b -2.05e+82)
(/ (- (- (/ (* 1.5 a) (/ b c)) b) b) (* a 3.0))
(if (<= b 2.3e-52)
(* (/ (- (sqrt (- (* b b) (* a (* c 3.0)))) b) a) 0.3333333333333333)
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.05e+82) {
tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 2.3e-52) {
tmp = ((sqrt(((b * b) - (a * (c * 3.0)))) - b) / a) * 0.3333333333333333;
} else {
tmp = -0.5 * (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 <= (-2.05d+82)) then
tmp = ((((1.5d0 * a) / (b / c)) - b) - b) / (a * 3.0d0)
else if (b <= 2.3d-52) then
tmp = ((sqrt(((b * b) - (a * (c * 3.0d0)))) - b) / a) * 0.3333333333333333d0
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.05e+82) {
tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 2.3e-52) {
tmp = ((Math.sqrt(((b * b) - (a * (c * 3.0)))) - b) / a) * 0.3333333333333333;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.05e+82: tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0) elif b <= 2.3e-52: tmp = ((math.sqrt(((b * b) - (a * (c * 3.0)))) - b) / a) * 0.3333333333333333 else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.05e+82) tmp = Float64(Float64(Float64(Float64(Float64(1.5 * a) / Float64(b / c)) - b) - b) / Float64(a * 3.0)); elseif (b <= 2.3e-52) tmp = Float64(Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(a * Float64(c * 3.0)))) - b) / a) * 0.3333333333333333); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.05e+82) tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0); elseif (b <= 2.3e-52) tmp = ((sqrt(((b * b) - (a * (c * 3.0)))) - b) / a) * 0.3333333333333333; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.05e+82], N[(N[(N[(N[(N[(1.5 * a), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.3e-52], N[(N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(a * N[(c * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.05 \cdot 10^{+82}:\\
\;\;\;\;\frac{\left(\frac{1.5 \cdot a}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{-52}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)} - b}{a} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -2.04999999999999998e82Initial program 56.2%
sqr-neg56.2%
sqr-neg56.2%
associate-*l*56.2%
Simplified56.2%
Taylor expanded in b around -inf 93.3%
+-commutative93.3%
mul-1-neg93.3%
unsub-neg93.3%
associate-/l*98.3%
associate-*r/98.3%
Simplified98.3%
if -2.04999999999999998e82 < b < 2.29999999999999994e-52Initial program 85.9%
neg-sub085.9%
sqr-neg85.9%
associate-+l-85.9%
sub0-neg85.9%
neg-mul-185.9%
Simplified85.7%
associate-*r*85.7%
metadata-eval85.7%
distribute-rgt-neg-in85.7%
*-commutative85.7%
fma-neg85.7%
associate-*r*85.7%
*-commutative85.7%
associate-*l*85.7%
Applied egg-rr85.7%
*-commutative85.7%
Simplified85.7%
associate-/r/85.8%
Applied egg-rr85.8%
if 2.29999999999999994e-52 < b Initial program 15.6%
sqr-neg15.6%
sqr-neg15.6%
associate-*l*15.5%
Simplified15.5%
Taylor expanded in b around inf 85.0%
Final simplification88.5%
(FPCore (a b c)
:precision binary64
(if (<= b -5.1e-41)
(/ (- (- (/ (* 1.5 a) (/ b c)) b) b) (* a 3.0))
(if (<= b 8.2e-51)
(* (/ 0.3333333333333333 a) (- (sqrt (* c (* a -3.0))) b))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.1e-41) {
tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 8.2e-51) {
tmp = (0.3333333333333333 / a) * (sqrt((c * (a * -3.0))) - b);
} else {
tmp = -0.5 * (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.1d-41)) then
tmp = ((((1.5d0 * a) / (b / c)) - b) - b) / (a * 3.0d0)
else if (b <= 8.2d-51) then
tmp = (0.3333333333333333d0 / a) * (sqrt((c * (a * (-3.0d0)))) - b)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5.1e-41) {
tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 8.2e-51) {
tmp = (0.3333333333333333 / a) * (Math.sqrt((c * (a * -3.0))) - b);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.1e-41: tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0) elif b <= 8.2e-51: tmp = (0.3333333333333333 / a) * (math.sqrt((c * (a * -3.0))) - b) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.1e-41) tmp = Float64(Float64(Float64(Float64(Float64(1.5 * a) / Float64(b / c)) - b) - b) / Float64(a * 3.0)); elseif (b <= 8.2e-51) tmp = Float64(Float64(0.3333333333333333 / a) * Float64(sqrt(Float64(c * Float64(a * -3.0))) - b)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5.1e-41) tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0); elseif (b <= 8.2e-51) tmp = (0.3333333333333333 / a) * (sqrt((c * (a * -3.0))) - b); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.1e-41], N[(N[(N[(N[(N[(1.5 * a), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.2e-51], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.1 \cdot 10^{-41}:\\
\;\;\;\;\frac{\left(\frac{1.5 \cdot a}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 8.2 \cdot 10^{-51}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(\sqrt{c \cdot \left(a \cdot -3\right)} - b\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -5.09999999999999976e-41Initial program 69.0%
sqr-neg69.0%
sqr-neg69.0%
associate-*l*69.0%
Simplified69.0%
Taylor expanded in b around -inf 85.0%
+-commutative85.0%
mul-1-neg85.0%
unsub-neg85.0%
associate-/l*88.3%
associate-*r/88.3%
Simplified88.3%
if -5.09999999999999976e-41 < b < 8.19999999999999947e-51Initial program 82.5%
sqr-neg82.5%
sqr-neg82.5%
associate-*l*82.2%
Simplified82.2%
Taylor expanded in b around 0 77.3%
*-commutative77.3%
Simplified77.3%
div-inv77.2%
+-commutative77.2%
associate-*l*77.3%
*-commutative77.3%
Applied egg-rr77.3%
*-commutative77.3%
*-commutative77.3%
associate-/r*77.2%
metadata-eval77.2%
unsub-neg77.2%
associate-*r*77.1%
*-commutative77.1%
associate-*l*77.3%
Simplified77.3%
if 8.19999999999999947e-51 < b Initial program 15.6%
sqr-neg15.6%
sqr-neg15.6%
associate-*l*15.5%
Simplified15.5%
Taylor expanded in b around inf 85.0%
Final simplification84.1%
(FPCore (a b c)
:precision binary64
(if (<= b -6e-41)
(/ (- (- (/ (* 1.5 a) (/ b c)) b) b) (* a 3.0))
(if (<= b 1.52e-58)
(/ (- (sqrt (* -3.0 (* a c))) b) (/ a 0.3333333333333333))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6e-41) {
tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 1.52e-58) {
tmp = (sqrt((-3.0 * (a * c))) - b) / (a / 0.3333333333333333);
} else {
tmp = -0.5 * (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 <= (-6d-41)) then
tmp = ((((1.5d0 * a) / (b / c)) - b) - b) / (a * 3.0d0)
else if (b <= 1.52d-58) then
tmp = (sqrt(((-3.0d0) * (a * c))) - b) / (a / 0.3333333333333333d0)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -6e-41) {
tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 1.52e-58) {
tmp = (Math.sqrt((-3.0 * (a * c))) - b) / (a / 0.3333333333333333);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6e-41: tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0) elif b <= 1.52e-58: tmp = (math.sqrt((-3.0 * (a * c))) - b) / (a / 0.3333333333333333) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6e-41) tmp = Float64(Float64(Float64(Float64(Float64(1.5 * a) / Float64(b / c)) - b) - b) / Float64(a * 3.0)); elseif (b <= 1.52e-58) tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(a / 0.3333333333333333)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -6e-41) tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0); elseif (b <= 1.52e-58) tmp = (sqrt((-3.0 * (a * c))) - b) / (a / 0.3333333333333333); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6e-41], N[(N[(N[(N[(N[(1.5 * a), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.52e-58], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a / 0.3333333333333333), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6 \cdot 10^{-41}:\\
\;\;\;\;\frac{\left(\frac{1.5 \cdot a}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 1.52 \cdot 10^{-58}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{\frac{a}{0.3333333333333333}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -5.99999999999999978e-41Initial program 69.0%
sqr-neg69.0%
sqr-neg69.0%
associate-*l*69.0%
Simplified69.0%
Taylor expanded in b around -inf 85.0%
+-commutative85.0%
mul-1-neg85.0%
unsub-neg85.0%
associate-/l*88.3%
associate-*r/88.3%
Simplified88.3%
if -5.99999999999999978e-41 < b < 1.51999999999999993e-58Initial program 82.5%
neg-sub082.5%
sqr-neg82.5%
associate-+l-82.5%
sub0-neg82.5%
neg-mul-182.5%
Simplified82.2%
associate-*r*82.2%
metadata-eval82.2%
distribute-rgt-neg-in82.2%
*-commutative82.2%
fma-neg82.2%
associate-*r*82.2%
*-commutative82.2%
associate-*l*82.2%
Applied egg-rr82.2%
*-commutative82.2%
Simplified82.2%
Taylor expanded in b around 0 77.3%
if 1.51999999999999993e-58 < b Initial program 15.6%
sqr-neg15.6%
sqr-neg15.6%
associate-*l*15.5%
Simplified15.5%
Taylor expanded in b around inf 85.0%
Final simplification84.1%
(FPCore (a b c)
:precision binary64
(if (<= b -1.1e-40)
(/ (- (- (/ (* 1.5 a) (/ b c)) b) b) (* a 3.0))
(if (<= b 1.55e-59)
(/ (- (sqrt (* a (* c -3.0))) b) (/ a 0.3333333333333333))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.1e-40) {
tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 1.55e-59) {
tmp = (sqrt((a * (c * -3.0))) - b) / (a / 0.3333333333333333);
} else {
tmp = -0.5 * (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.1d-40)) then
tmp = ((((1.5d0 * a) / (b / c)) - b) - b) / (a * 3.0d0)
else if (b <= 1.55d-59) then
tmp = (sqrt((a * (c * (-3.0d0)))) - b) / (a / 0.3333333333333333d0)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.1e-40) {
tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 1.55e-59) {
tmp = (Math.sqrt((a * (c * -3.0))) - b) / (a / 0.3333333333333333);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.1e-40: tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0) elif b <= 1.55e-59: tmp = (math.sqrt((a * (c * -3.0))) - b) / (a / 0.3333333333333333) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.1e-40) tmp = Float64(Float64(Float64(Float64(Float64(1.5 * a) / Float64(b / c)) - b) - b) / Float64(a * 3.0)); elseif (b <= 1.55e-59) tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / Float64(a / 0.3333333333333333)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.1e-40) tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0); elseif (b <= 1.55e-59) tmp = (sqrt((a * (c * -3.0))) - b) / (a / 0.3333333333333333); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.1e-40], N[(N[(N[(N[(N[(1.5 * a), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.55e-59], N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a / 0.3333333333333333), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.1 \cdot 10^{-40}:\\
\;\;\;\;\frac{\left(\frac{1.5 \cdot a}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 1.55 \cdot 10^{-59}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{\frac{a}{0.3333333333333333}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.10000000000000004e-40Initial program 69.0%
sqr-neg69.0%
sqr-neg69.0%
associate-*l*69.0%
Simplified69.0%
Taylor expanded in b around -inf 85.0%
+-commutative85.0%
mul-1-neg85.0%
unsub-neg85.0%
associate-/l*88.3%
associate-*r/88.3%
Simplified88.3%
if -1.10000000000000004e-40 < b < 1.55e-59Initial program 82.5%
neg-sub082.5%
sqr-neg82.5%
associate-+l-82.5%
sub0-neg82.5%
neg-mul-182.5%
Simplified82.2%
associate-*r*82.2%
metadata-eval82.2%
distribute-rgt-neg-in82.2%
*-commutative82.2%
fma-neg82.2%
associate-*r*82.2%
*-commutative82.2%
associate-*l*82.2%
Applied egg-rr82.2%
*-commutative82.2%
Simplified82.2%
Taylor expanded in b around 0 77.3%
*-commutative77.3%
associate-*r*77.3%
Simplified77.3%
if 1.55e-59 < b Initial program 15.6%
sqr-neg15.6%
sqr-neg15.6%
associate-*l*15.5%
Simplified15.5%
Taylor expanded in b around inf 85.0%
Final simplification84.1%
(FPCore (a b c)
:precision binary64
(if (<= b -2.1e-40)
(/ (- (- (/ (* 1.5 a) (/ b c)) b) b) (* a 3.0))
(if (<= b 1.25e-59)
(/ (- (sqrt (* a (* c -3.0))) b) (* a 3.0))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.1e-40) {
tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 1.25e-59) {
tmp = (sqrt((a * (c * -3.0))) - b) / (a * 3.0);
} else {
tmp = -0.5 * (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 <= (-2.1d-40)) then
tmp = ((((1.5d0 * a) / (b / c)) - b) - b) / (a * 3.0d0)
else if (b <= 1.25d-59) then
tmp = (sqrt((a * (c * (-3.0d0)))) - b) / (a * 3.0d0)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.1e-40) {
tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 1.25e-59) {
tmp = (Math.sqrt((a * (c * -3.0))) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.1e-40: tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0) elif b <= 1.25e-59: tmp = (math.sqrt((a * (c * -3.0))) - b) / (a * 3.0) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.1e-40) tmp = Float64(Float64(Float64(Float64(Float64(1.5 * a) / Float64(b / c)) - b) - b) / Float64(a * 3.0)); elseif (b <= 1.25e-59) tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.1e-40) tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0); elseif (b <= 1.25e-59) tmp = (sqrt((a * (c * -3.0))) - b) / (a * 3.0); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.1e-40], N[(N[(N[(N[(N[(1.5 * a), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.25e-59], N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.1 \cdot 10^{-40}:\\
\;\;\;\;\frac{\left(\frac{1.5 \cdot a}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 1.25 \cdot 10^{-59}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -2.10000000000000018e-40Initial program 69.0%
sqr-neg69.0%
sqr-neg69.0%
associate-*l*69.0%
Simplified69.0%
Taylor expanded in b around -inf 85.0%
+-commutative85.0%
mul-1-neg85.0%
unsub-neg85.0%
associate-/l*88.3%
associate-*r/88.3%
Simplified88.3%
if -2.10000000000000018e-40 < b < 1.25e-59Initial program 82.5%
sqr-neg82.5%
sqr-neg82.5%
associate-*l*82.2%
Simplified82.2%
Taylor expanded in b around 0 77.3%
associate-*r*77.6%
*-commutative77.6%
associate-*l*77.4%
Simplified77.4%
if 1.25e-59 < b Initial program 15.6%
sqr-neg15.6%
sqr-neg15.6%
associate-*l*15.5%
Simplified15.5%
Taylor expanded in b around inf 85.0%
Final simplification84.1%
(FPCore (a b c) :precision binary64 (if (<= b -1e-311) (/ (- (- (/ (* 1.5 a) (/ b c)) b) b) (* a 3.0)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-311) {
tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1d-311)) then
tmp = ((((1.5d0 * a) / (b / c)) - b) - b) / (a * 3.0d0)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e-311) {
tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-311: tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-311) tmp = Float64(Float64(Float64(Float64(Float64(1.5 * a) / Float64(b / c)) - b) - b) / Float64(a * 3.0)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-311) tmp = ((((1.5 * a) / (b / c)) - b) - b) / (a * 3.0); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-311], N[(N[(N[(N[(N[(1.5 * a), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\frac{\left(\frac{1.5 \cdot a}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -9.99999999999948e-312Initial program 73.6%
sqr-neg73.6%
sqr-neg73.6%
associate-*l*73.6%
Simplified73.6%
Taylor expanded in b around -inf 67.2%
+-commutative67.2%
mul-1-neg67.2%
unsub-neg67.2%
associate-/l*69.5%
associate-*r/69.5%
Simplified69.5%
if -9.99999999999948e-312 < b Initial program 33.5%
sqr-neg33.5%
sqr-neg33.5%
associate-*l*33.4%
Simplified33.4%
Taylor expanded in b around inf 65.2%
Final simplification67.3%
(FPCore (a b c) :precision binary64 (if (<= b -1e-311) (+ (* (/ c b) 0.5) (* -0.6666666666666666 (/ b a))) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-311) {
tmp = ((c / b) * 0.5) + (-0.6666666666666666 * (b / a));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1d-311)) then
tmp = ((c / b) * 0.5d0) + ((-0.6666666666666666d0) * (b / a))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e-311) {
tmp = ((c / b) * 0.5) + (-0.6666666666666666 * (b / a));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-311: tmp = ((c / b) * 0.5) + (-0.6666666666666666 * (b / a)) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-311) tmp = Float64(Float64(Float64(c / b) * 0.5) + Float64(-0.6666666666666666 * Float64(b / a))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-311) tmp = ((c / b) * 0.5) + (-0.6666666666666666 * (b / a)); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-311], N[(N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision] + N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\frac{c}{b} \cdot 0.5 + -0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -9.99999999999948e-312Initial program 73.6%
sqr-neg73.6%
sqr-neg73.6%
associate-*l*73.6%
Simplified73.6%
Taylor expanded in b around -inf 69.4%
if -9.99999999999948e-312 < b Initial program 33.5%
sqr-neg33.5%
sqr-neg33.5%
associate-*l*33.4%
Simplified33.4%
Taylor expanded in b around inf 65.2%
Final simplification67.2%
(FPCore (a b c) :precision binary64 (if (<= b -1e-311) (+ (/ (* b -0.6666666666666666) a) (* (/ c b) 0.5)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-311) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1d-311)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + ((c / b) * 0.5d0)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e-311) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-311: tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-311) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(Float64(c / b) * 0.5)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-311) tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-311], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -9.99999999999948e-312Initial program 73.6%
sqr-neg73.6%
sqr-neg73.6%
associate-*l*73.6%
Simplified73.6%
Taylor expanded in b around -inf 69.4%
associate-*r/69.5%
Applied egg-rr69.5%
if -9.99999999999948e-312 < b Initial program 33.5%
sqr-neg33.5%
sqr-neg33.5%
associate-*l*33.4%
Simplified33.4%
Taylor expanded in b around inf 65.2%
Final simplification67.3%
(FPCore (a b c) :precision binary64 (if (<= b -1e-311) (/ (* b -2.0) (* a 3.0)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-311) {
tmp = (b * -2.0) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1d-311)) then
tmp = (b * (-2.0d0)) / (a * 3.0d0)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e-311) {
tmp = (b * -2.0) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-311: tmp = (b * -2.0) / (a * 3.0) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-311) tmp = Float64(Float64(b * -2.0) / Float64(a * 3.0)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-311) tmp = (b * -2.0) / (a * 3.0); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-311], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -9.99999999999948e-312Initial program 73.6%
sqr-neg73.6%
sqr-neg73.6%
associate-*l*73.6%
Simplified73.6%
Taylor expanded in b around -inf 69.4%
*-commutative69.4%
Simplified69.4%
if -9.99999999999948e-312 < b Initial program 33.5%
sqr-neg33.5%
sqr-neg33.5%
associate-*l*33.4%
Simplified33.4%
Taylor expanded in b around inf 65.2%
Final simplification67.2%
(FPCore (a b c) :precision binary64 (if (<= b -1e-311) (* -0.6666666666666666 (/ b a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-311) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1d-311)) then
tmp = (-0.6666666666666666d0) * (b / a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e-311) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-311: tmp = -0.6666666666666666 * (b / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-311) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-311) tmp = -0.6666666666666666 * (b / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-311], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-311}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -9.99999999999948e-312Initial program 73.6%
sqr-neg73.6%
sqr-neg73.6%
associate-*l*73.6%
Simplified73.6%
Taylor expanded in b around -inf 69.2%
*-commutative69.2%
Simplified69.2%
if -9.99999999999948e-312 < b Initial program 33.5%
sqr-neg33.5%
sqr-neg33.5%
associate-*l*33.4%
Simplified33.4%
Taylor expanded in b around inf 65.2%
Final simplification67.1%
(FPCore (a b c) :precision binary64 (if (<= b -1e-311) (/ (* b -0.6666666666666666) a) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-311) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1d-311)) then
tmp = (b * (-0.6666666666666666d0)) / a
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e-311) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-311: tmp = (b * -0.6666666666666666) / a else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-311) tmp = Float64(Float64(b * -0.6666666666666666) / a); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-311) tmp = (b * -0.6666666666666666) / a; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-311], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -9.99999999999948e-312Initial program 73.6%
sqr-neg73.6%
sqr-neg73.6%
associate-*l*73.6%
Simplified73.6%
Taylor expanded in b around -inf 69.2%
*-commutative69.2%
Simplified69.2%
associate-*l/69.3%
Applied egg-rr69.3%
if -9.99999999999948e-312 < b Initial program 33.5%
sqr-neg33.5%
sqr-neg33.5%
associate-*l*33.4%
Simplified33.4%
Taylor expanded in b around inf 65.2%
Final simplification67.2%
(FPCore (a b c) :precision binary64 (* -0.5 (/ c b)))
double code(double a, double b, double c) {
return -0.5 * (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 = (-0.5d0) * (c / b)
end function
public static double code(double a, double b, double c) {
return -0.5 * (c / b);
}
def code(a, b, c): return -0.5 * (c / b)
function code(a, b, c) return Float64(-0.5 * Float64(c / b)) end
function tmp = code(a, b, c) tmp = -0.5 * (c / b); end
code[a_, b_, c_] := N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot \frac{c}{b}
\end{array}
Initial program 53.3%
sqr-neg53.3%
sqr-neg53.3%
associate-*l*53.2%
Simplified53.2%
Taylor expanded in b around inf 34.3%
Final simplification34.3%
herbie shell --seed 2023283
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))