
(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 13 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 -2.3e+83)
(/ (* -0.3333333333333333 (fma b 2.0 (* -1.5 (/ c (/ b a))))) a)
(if (<= b 3.7e-81)
(/ (- (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 <= -2.3e+83) {
tmp = (-0.3333333333333333 * fma(b, 2.0, (-1.5 * (c / (b / a))))) / a;
} else if (b <= 3.7e-81) {
tmp = (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 <= -2.3e+83) tmp = Float64(Float64(-0.3333333333333333 * fma(b, 2.0, Float64(-1.5 * Float64(c / Float64(b / a))))) / a); elseif (b <= 3.7e-81) 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
code[a_, b_, c_] := If[LessEqual[b, -2.3e+83], N[(N[(-0.3333333333333333 * N[(b * 2.0 + N[(-1.5 * N[(c / N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 3.7e-81], 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 -2.3 \cdot 10^{+83}:\\
\;\;\;\;\frac{-0.3333333333333333 \cdot \mathsf{fma}\left(b, 2, -1.5 \cdot \frac{c}{\frac{b}{a}}\right)}{a}\\
\mathbf{elif}\;b \leq 3.7 \cdot 10^{-81}:\\
\;\;\;\;\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 < -2.29999999999999995e83Initial program 52.8%
/-rgt-identity52.8%
metadata-eval52.8%
associate-/r/52.8%
metadata-eval52.8%
metadata-eval52.8%
times-frac52.8%
*-commutative52.8%
times-frac52.8%
*-commutative52.8%
associate-/r*52.8%
associate-*l/52.8%
Simplified52.8%
Taylor expanded in b around -inf 92.4%
+-commutative92.4%
*-commutative92.4%
fma-def92.4%
associate-/l*95.5%
Simplified95.5%
if -2.29999999999999995e83 < b < 3.69999999999999986e-81Initial program 87.5%
if 3.69999999999999986e-81 < b Initial program 15.0%
/-rgt-identity15.0%
metadata-eval15.0%
associate-/r/15.0%
metadata-eval15.0%
metadata-eval15.0%
times-frac15.0%
*-commutative15.0%
times-frac15.0%
associate-/r*15.0%
Simplified16.1%
Taylor expanded in b around inf 24.6%
clear-num24.6%
inv-pow24.6%
Applied egg-rr24.6%
unpow-124.6%
Simplified24.6%
Taylor expanded in b around 0 85.5%
*-commutative85.5%
associate-*l/85.5%
Simplified85.5%
Final simplification88.9%
(FPCore (a b c)
:precision binary64
(if (<= b -1.2e+114)
(/ (* -0.3333333333333333 (fma b 2.0 (* -1.5 (/ c (/ b a))))) a)
(if (<= b 3.1e-81)
(/ (* -0.3333333333333333 (- b (sqrt (- (* b b) (* c (* a 3.0)))))) a)
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.2e+114) {
tmp = (-0.3333333333333333 * fma(b, 2.0, (-1.5 * (c / (b / a))))) / a;
} else if (b <= 3.1e-81) {
tmp = (-0.3333333333333333 * (b - sqrt(((b * b) - (c * (a * 3.0)))))) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -1.2e+114) tmp = Float64(Float64(-0.3333333333333333 * fma(b, 2.0, Float64(-1.5 * Float64(c / Float64(b / a))))) / a); elseif (b <= 3.1e-81) tmp = Float64(Float64(-0.3333333333333333 * Float64(b - sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))))) / a); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -1.2e+114], N[(N[(-0.3333333333333333 * N[(b * 2.0 + N[(-1.5 * N[(c / N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 3.1e-81], N[(N[(-0.3333333333333333 * N[(b - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.2 \cdot 10^{+114}:\\
\;\;\;\;\frac{-0.3333333333333333 \cdot \mathsf{fma}\left(b, 2, -1.5 \cdot \frac{c}{\frac{b}{a}}\right)}{a}\\
\mathbf{elif}\;b \leq 3.1 \cdot 10^{-81}:\\
\;\;\;\;\frac{-0.3333333333333333 \cdot \left(b - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.2e114Initial program 49.0%
/-rgt-identity49.0%
metadata-eval49.0%
associate-/r/49.0%
metadata-eval49.0%
metadata-eval49.0%
times-frac49.0%
*-commutative49.0%
times-frac49.0%
*-commutative49.0%
associate-/r*49.0%
associate-*l/49.0%
Simplified49.0%
Taylor expanded in b around -inf 91.8%
+-commutative91.8%
*-commutative91.8%
fma-def91.8%
associate-/l*95.1%
Simplified95.1%
if -1.2e114 < b < 3.09999999999999988e-81Initial program 88.0%
/-rgt-identity88.0%
metadata-eval88.0%
associate-/r/88.0%
metadata-eval88.0%
metadata-eval88.0%
times-frac88.0%
*-commutative88.0%
times-frac87.9%
*-commutative87.9%
associate-/r*87.8%
associate-*l/87.9%
Simplified87.8%
fma-udef87.8%
*-commutative87.8%
metadata-eval87.8%
cancel-sign-sub-inv87.8%
associate-*r*87.9%
*-commutative87.9%
*-commutative87.9%
Applied egg-rr87.9%
if 3.09999999999999988e-81 < b Initial program 15.0%
/-rgt-identity15.0%
metadata-eval15.0%
associate-/r/15.0%
metadata-eval15.0%
metadata-eval15.0%
times-frac15.0%
*-commutative15.0%
times-frac15.0%
associate-/r*15.0%
Simplified16.1%
Taylor expanded in b around inf 24.6%
clear-num24.6%
inv-pow24.6%
Applied egg-rr24.6%
unpow-124.6%
Simplified24.6%
Taylor expanded in b around 0 85.5%
*-commutative85.5%
associate-*l/85.5%
Simplified85.5%
Final simplification88.8%
(FPCore (a b c)
:precision binary64
(if (<= b -3.2e+82)
(/ (* -0.3333333333333333 (fma b 2.0 (* -1.5 (/ c (/ b a))))) a)
(if (<= b 1.7e-81)
(/ (- (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.2e+82) {
tmp = (-0.3333333333333333 * fma(b, 2.0, (-1.5 * (c / (b / a))))) / a;
} else if (b <= 1.7e-81) {
tmp = (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.2e+82) tmp = Float64(Float64(-0.3333333333333333 * fma(b, 2.0, Float64(-1.5 * Float64(c / Float64(b / a))))) / a); elseif (b <= 1.7e-81) 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
code[a_, b_, c_] := If[LessEqual[b, -3.2e+82], N[(N[(-0.3333333333333333 * N[(b * 2.0 + N[(-1.5 * N[(c / N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 1.7e-81], 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.2 \cdot 10^{+82}:\\
\;\;\;\;\frac{-0.3333333333333333 \cdot \mathsf{fma}\left(b, 2, -1.5 \cdot \frac{c}{\frac{b}{a}}\right)}{a}\\
\mathbf{elif}\;b \leq 1.7 \cdot 10^{-81}:\\
\;\;\;\;\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.19999999999999975e82Initial program 52.8%
/-rgt-identity52.8%
metadata-eval52.8%
associate-/r/52.8%
metadata-eval52.8%
metadata-eval52.8%
times-frac52.8%
*-commutative52.8%
times-frac52.8%
*-commutative52.8%
associate-/r*52.8%
associate-*l/52.8%
Simplified52.8%
Taylor expanded in b around -inf 92.4%
+-commutative92.4%
*-commutative92.4%
fma-def92.4%
associate-/l*95.5%
Simplified95.5%
if -3.19999999999999975e82 < b < 1.6999999999999999e-81Initial program 87.5%
neg-sub087.5%
associate-+l-87.5%
sub0-neg87.5%
neg-mul-187.5%
associate-*r/87.5%
metadata-eval87.5%
metadata-eval87.5%
times-frac87.5%
*-commutative87.5%
times-frac87.3%
associate-*l/87.5%
Simplified87.3%
if 1.6999999999999999e-81 < b Initial program 15.0%
/-rgt-identity15.0%
metadata-eval15.0%
associate-/r/15.0%
metadata-eval15.0%
metadata-eval15.0%
times-frac15.0%
*-commutative15.0%
times-frac15.0%
associate-/r*15.0%
Simplified16.1%
Taylor expanded in b around inf 24.6%
clear-num24.6%
inv-pow24.6%
Applied egg-rr24.6%
unpow-124.6%
Simplified24.6%
Taylor expanded in b around 0 85.5%
*-commutative85.5%
associate-*l/85.5%
Simplified85.5%
Final simplification88.8%
(FPCore (a b c)
:precision binary64
(if (<= b -4.2e-38)
(+ (* (/ b a) -0.6666666666666666) (* 0.5 (/ c b)))
(if (<= b 1.5e-81)
(* (- 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 <= -4.2e-38) {
tmp = ((b / a) * -0.6666666666666666) + (0.5 * (c / b));
} else if (b <= 1.5e-81) {
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 <= (-4.2d-38)) then
tmp = ((b / a) * (-0.6666666666666666d0)) + (0.5d0 * (c / b))
else if (b <= 1.5d-81) 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 <= -4.2e-38) {
tmp = ((b / a) * -0.6666666666666666) + (0.5 * (c / b));
} else if (b <= 1.5e-81) {
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 <= -4.2e-38: tmp = ((b / a) * -0.6666666666666666) + (0.5 * (c / b)) elif b <= 1.5e-81: 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 <= -4.2e-38) tmp = Float64(Float64(Float64(b / a) * -0.6666666666666666) + Float64(0.5 * Float64(c / b))); elseif (b <= 1.5e-81) 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 <= -4.2e-38) tmp = ((b / a) * -0.6666666666666666) + (0.5 * (c / b)); elseif (b <= 1.5e-81) 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, -4.2e-38], N[(N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.5e-81], 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 -4.2 \cdot 10^{-38}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666 + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{-81}:\\
\;\;\;\;\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 < -4.20000000000000026e-38Initial program 65.9%
/-rgt-identity65.9%
metadata-eval65.9%
associate-/r/65.9%
metadata-eval65.9%
metadata-eval65.9%
times-frac65.9%
*-commutative65.9%
times-frac65.9%
*-commutative65.9%
associate-/r*65.8%
associate-*l/65.8%
Simplified65.8%
Taylor expanded in b around -inf 91.5%
if -4.20000000000000026e-38 < b < 1.4999999999999999e-81Initial program 83.4%
/-rgt-identity83.4%
metadata-eval83.4%
associate-/r/83.4%
metadata-eval83.4%
metadata-eval83.4%
times-frac83.4%
*-commutative83.4%
times-frac83.1%
associate-/r*83.0%
Simplified82.9%
Taylor expanded in b around 0 79.5%
*-commutative79.5%
metadata-eval79.5%
distribute-rgt-neg-in79.5%
associate-*r*79.6%
distribute-rgt-neg-in79.6%
metadata-eval79.6%
distribute-rgt-neg-in79.6%
distribute-lft-neg-in79.6%
distribute-lft-neg-out79.6%
remove-double-neg79.6%
Simplified79.6%
if 1.4999999999999999e-81 < b Initial program 15.5%
/-rgt-identity15.5%
metadata-eval15.5%
associate-/r/15.5%
metadata-eval15.5%
metadata-eval15.5%
times-frac15.5%
*-commutative15.5%
times-frac15.5%
associate-/r*15.6%
Simplified16.6%
Taylor expanded in b around inf 25.0%
clear-num25.0%
inv-pow25.0%
Applied egg-rr25.0%
unpow-125.0%
Simplified25.0%
Taylor expanded in b around 0 85.2%
*-commutative85.2%
associate-*l/85.2%
Simplified85.2%
Final simplification85.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2.65e-39)
(+ (* (/ b a) -0.6666666666666666) (* 0.5 (/ c b)))
(if (<= b 1.45e-81)
(/ (* -0.3333333333333333 (- b (sqrt (* c (* a -3.0))))) a)
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.65e-39) {
tmp = ((b / a) * -0.6666666666666666) + (0.5 * (c / b));
} else if (b <= 1.45e-81) {
tmp = (-0.3333333333333333 * (b - sqrt((c * (a * -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.65d-39)) then
tmp = ((b / a) * (-0.6666666666666666d0)) + (0.5d0 * (c / b))
else if (b <= 1.45d-81) then
tmp = ((-0.3333333333333333d0) * (b - sqrt((c * (a * (-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.65e-39) {
tmp = ((b / a) * -0.6666666666666666) + (0.5 * (c / b));
} else if (b <= 1.45e-81) {
tmp = (-0.3333333333333333 * (b - Math.sqrt((c * (a * -3.0))))) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.65e-39: tmp = ((b / a) * -0.6666666666666666) + (0.5 * (c / b)) elif b <= 1.45e-81: tmp = (-0.3333333333333333 * (b - math.sqrt((c * (a * -3.0))))) / a else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.65e-39) tmp = Float64(Float64(Float64(b / a) * -0.6666666666666666) + Float64(0.5 * Float64(c / b))); elseif (b <= 1.45e-81) tmp = Float64(Float64(-0.3333333333333333 * Float64(b - sqrt(Float64(c * Float64(a * -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.65e-39) tmp = ((b / a) * -0.6666666666666666) + (0.5 * (c / b)); elseif (b <= 1.45e-81) tmp = (-0.3333333333333333 * (b - sqrt((c * (a * -3.0))))) / a; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.65e-39], N[(N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.45e-81], N[(N[(-0.3333333333333333 * N[(b - N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.65 \cdot 10^{-39}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666 + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 1.45 \cdot 10^{-81}:\\
\;\;\;\;\frac{-0.3333333333333333 \cdot \left(b - \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.65000000000000002e-39Initial program 65.9%
/-rgt-identity65.9%
metadata-eval65.9%
associate-/r/65.9%
metadata-eval65.9%
metadata-eval65.9%
times-frac65.9%
*-commutative65.9%
times-frac65.9%
*-commutative65.9%
associate-/r*65.8%
associate-*l/65.8%
Simplified65.8%
Taylor expanded in b around -inf 91.5%
if -2.65000000000000002e-39 < b < 1.44999999999999994e-81Initial program 83.4%
/-rgt-identity83.4%
metadata-eval83.4%
associate-/r/83.4%
metadata-eval83.4%
metadata-eval83.4%
times-frac83.4%
*-commutative83.4%
times-frac83.1%
*-commutative83.1%
associate-/r*83.0%
associate-*l/83.2%
Simplified83.1%
Taylor expanded in b around 0 79.7%
*-commutative79.5%
metadata-eval79.5%
distribute-rgt-neg-in79.5%
associate-*r*79.6%
distribute-rgt-neg-in79.6%
metadata-eval79.6%
distribute-rgt-neg-in79.6%
distribute-lft-neg-in79.6%
distribute-lft-neg-out79.6%
remove-double-neg79.6%
Simplified79.8%
if 1.44999999999999994e-81 < b Initial program 15.5%
/-rgt-identity15.5%
metadata-eval15.5%
associate-/r/15.5%
metadata-eval15.5%
metadata-eval15.5%
times-frac15.5%
*-commutative15.5%
times-frac15.5%
associate-/r*15.6%
Simplified16.6%
Taylor expanded in b around inf 25.0%
clear-num25.0%
inv-pow25.0%
Applied egg-rr25.0%
unpow-125.0%
Simplified25.0%
Taylor expanded in b around 0 85.2%
*-commutative85.2%
associate-*l/85.2%
Simplified85.2%
Final simplification86.0%
(FPCore (a b c)
:precision binary64
(if (<= b -2.7e-38)
(/ (* -0.3333333333333333 (fma b 2.0 (* -1.5 (/ c (/ b a))))) a)
(if (<= b 1.5e-81)
(/ (* -0.3333333333333333 (- b (sqrt (* c (* a -3.0))))) a)
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.7e-38) {
tmp = (-0.3333333333333333 * fma(b, 2.0, (-1.5 * (c / (b / a))))) / a;
} else if (b <= 1.5e-81) {
tmp = (-0.3333333333333333 * (b - sqrt((c * (a * -3.0))))) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2.7e-38) tmp = Float64(Float64(-0.3333333333333333 * fma(b, 2.0, Float64(-1.5 * Float64(c / Float64(b / a))))) / a); elseif (b <= 1.5e-81) tmp = Float64(Float64(-0.3333333333333333 * Float64(b - sqrt(Float64(c * Float64(a * -3.0))))) / a); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.7e-38], N[(N[(-0.3333333333333333 * N[(b * 2.0 + N[(-1.5 * N[(c / N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 1.5e-81], N[(N[(-0.3333333333333333 * N[(b - N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.7 \cdot 10^{-38}:\\
\;\;\;\;\frac{-0.3333333333333333 \cdot \mathsf{fma}\left(b, 2, -1.5 \cdot \frac{c}{\frac{b}{a}}\right)}{a}\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{-81}:\\
\;\;\;\;\frac{-0.3333333333333333 \cdot \left(b - \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.70000000000000005e-38Initial program 65.9%
/-rgt-identity65.9%
metadata-eval65.9%
associate-/r/65.9%
metadata-eval65.9%
metadata-eval65.9%
times-frac65.9%
*-commutative65.9%
times-frac65.9%
*-commutative65.9%
associate-/r*65.8%
associate-*l/65.8%
Simplified65.8%
Taylor expanded in b around -inf 89.4%
+-commutative89.4%
*-commutative89.4%
fma-def89.4%
associate-/l*91.6%
Simplified91.6%
if -2.70000000000000005e-38 < b < 1.4999999999999999e-81Initial program 83.4%
/-rgt-identity83.4%
metadata-eval83.4%
associate-/r/83.4%
metadata-eval83.4%
metadata-eval83.4%
times-frac83.4%
*-commutative83.4%
times-frac83.1%
*-commutative83.1%
associate-/r*83.0%
associate-*l/83.2%
Simplified83.1%
Taylor expanded in b around 0 79.7%
*-commutative79.5%
metadata-eval79.5%
distribute-rgt-neg-in79.5%
associate-*r*79.6%
distribute-rgt-neg-in79.6%
metadata-eval79.6%
distribute-rgt-neg-in79.6%
distribute-lft-neg-in79.6%
distribute-lft-neg-out79.6%
remove-double-neg79.6%
Simplified79.8%
if 1.4999999999999999e-81 < b Initial program 15.5%
/-rgt-identity15.5%
metadata-eval15.5%
associate-/r/15.5%
metadata-eval15.5%
metadata-eval15.5%
times-frac15.5%
*-commutative15.5%
times-frac15.5%
associate-/r*15.6%
Simplified16.6%
Taylor expanded in b around inf 25.0%
clear-num25.0%
inv-pow25.0%
Applied egg-rr25.0%
unpow-125.0%
Simplified25.0%
Taylor expanded in b around 0 85.2%
*-commutative85.2%
associate-*l/85.2%
Simplified85.2%
Final simplification86.0%
(FPCore (a b c) :precision binary64 (if (<= b 1.05e-297) (* (/ -0.3333333333333333 a) (* b 2.0)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.05e-297) {
tmp = (-0.3333333333333333 / a) * (b * 2.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 <= 1.05d-297) then
tmp = ((-0.3333333333333333d0) / a) * (b * 2.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 <= 1.05e-297) {
tmp = (-0.3333333333333333 / a) * (b * 2.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.05e-297: tmp = (-0.3333333333333333 / a) * (b * 2.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.05e-297) tmp = Float64(Float64(-0.3333333333333333 / a) * Float64(b * 2.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 <= 1.05e-297) tmp = (-0.3333333333333333 / a) * (b * 2.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.05e-297], N[(N[(-0.3333333333333333 / a), $MachinePrecision] * N[(b * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.05 \cdot 10^{-297}:\\
\;\;\;\;\frac{-0.3333333333333333}{a} \cdot \left(b \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 1.05000000000000007e-297Initial program 72.7%
/-rgt-identity72.7%
metadata-eval72.7%
associate-/r/72.7%
metadata-eval72.7%
metadata-eval72.7%
times-frac72.7%
*-commutative72.7%
times-frac72.6%
associate-/r*72.5%
Simplified72.5%
Taylor expanded in b around -inf 68.6%
*-commutative68.6%
Simplified68.6%
if 1.05000000000000007e-297 < b Initial program 32.2%
/-rgt-identity32.2%
metadata-eval32.2%
associate-/r/32.2%
metadata-eval32.2%
metadata-eval32.2%
times-frac32.2%
*-commutative32.2%
times-frac32.1%
associate-/r*32.1%
Simplified32.9%
Taylor expanded in b around inf 19.4%
clear-num19.4%
inv-pow19.4%
Applied egg-rr19.4%
unpow-119.4%
Simplified19.4%
Taylor expanded in b around 0 67.2%
*-commutative67.2%
associate-*l/67.2%
Simplified67.2%
Final simplification67.9%
(FPCore (a b c) :precision binary64 (if (<= b 4.2e-303) (* (/ b 3.0) (/ -2.0 a)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-303) {
tmp = (b / 3.0) * (-2.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 <= 4.2d-303) then
tmp = (b / 3.0d0) * ((-2.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 <= 4.2e-303) {
tmp = (b / 3.0) * (-2.0 / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 4.2e-303: tmp = (b / 3.0) * (-2.0 / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 4.2e-303) tmp = Float64(Float64(b / 3.0) * Float64(-2.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 <= 4.2e-303) tmp = (b / 3.0) * (-2.0 / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 4.2e-303], N[(N[(b / 3.0), $MachinePrecision] * N[(-2.0 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.2 \cdot 10^{-303}:\\
\;\;\;\;\frac{b}{3} \cdot \frac{-2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 4.2e-303Initial program 72.7%
neg-sub072.7%
associate-+l-72.7%
sub0-neg72.7%
neg-mul-172.7%
associate-*r/72.7%
metadata-eval72.7%
metadata-eval72.7%
times-frac72.7%
*-commutative72.7%
times-frac72.6%
associate-*l/72.7%
Simplified72.6%
Taylor expanded in b around -inf 68.7%
*-commutative68.7%
Simplified68.7%
times-frac68.6%
Applied egg-rr68.6%
if 4.2e-303 < b Initial program 32.2%
/-rgt-identity32.2%
metadata-eval32.2%
associate-/r/32.2%
metadata-eval32.2%
metadata-eval32.2%
times-frac32.2%
*-commutative32.2%
times-frac32.1%
associate-/r*32.1%
Simplified32.9%
Taylor expanded in b around inf 19.4%
clear-num19.4%
inv-pow19.4%
Applied egg-rr19.4%
unpow-119.4%
Simplified19.4%
Taylor expanded in b around 0 67.2%
*-commutative67.2%
associate-*l/67.2%
Simplified67.2%
Final simplification67.9%
(FPCore (a b c) :precision binary64 (if (<= b 1.25e-301) (/ (* b -2.0) (* a 3.0)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.25e-301) {
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 <= 1.25d-301) 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 <= 1.25e-301) {
tmp = (b * -2.0) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.25e-301: 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 <= 1.25e-301) tmp = Float64(Float64(b * -2.0) / 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 <= 1.25e-301) 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, 1.25e-301], N[(N[(b * -2.0), $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.25 \cdot 10^{-301}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 1.25000000000000003e-301Initial program 72.7%
neg-sub072.7%
associate-+l-72.7%
sub0-neg72.7%
neg-mul-172.7%
associate-*r/72.7%
metadata-eval72.7%
metadata-eval72.7%
times-frac72.7%
*-commutative72.7%
times-frac72.6%
associate-*l/72.7%
Simplified72.6%
Taylor expanded in b around -inf 68.7%
*-commutative68.7%
Simplified68.7%
if 1.25000000000000003e-301 < b Initial program 32.2%
/-rgt-identity32.2%
metadata-eval32.2%
associate-/r/32.2%
metadata-eval32.2%
metadata-eval32.2%
times-frac32.2%
*-commutative32.2%
times-frac32.1%
associate-/r*32.1%
Simplified32.9%
Taylor expanded in b around inf 19.4%
clear-num19.4%
inv-pow19.4%
Applied egg-rr19.4%
unpow-119.4%
Simplified19.4%
Taylor expanded in b around 0 67.2%
*-commutative67.2%
associate-*l/67.2%
Simplified67.2%
Final simplification67.9%
(FPCore (a b c) :precision binary64 (if (<= b 1.32e-303) (* (/ b a) -0.6666666666666666) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.32e-303) {
tmp = (b / a) * -0.6666666666666666;
} 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.32d-303) then
tmp = (b / a) * (-0.6666666666666666d0)
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.32e-303) {
tmp = (b / a) * -0.6666666666666666;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.32e-303: tmp = (b / a) * -0.6666666666666666 else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.32e-303) tmp = Float64(Float64(b / a) * -0.6666666666666666); 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.32e-303) tmp = (b / a) * -0.6666666666666666; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.32e-303], N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.32 \cdot 10^{-303}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 1.32000000000000005e-303Initial program 72.7%
/-rgt-identity72.7%
metadata-eval72.7%
associate-/r/72.7%
metadata-eval72.7%
metadata-eval72.7%
times-frac72.7%
*-commutative72.7%
times-frac72.6%
*-commutative72.6%
associate-/r*72.5%
associate-*l/72.5%
Simplified72.4%
Taylor expanded in b around -inf 68.5%
*-commutative68.5%
Simplified68.5%
if 1.32000000000000005e-303 < b Initial program 32.2%
/-rgt-identity32.2%
metadata-eval32.2%
associate-/r/32.2%
metadata-eval32.2%
metadata-eval32.2%
times-frac32.2%
*-commutative32.2%
times-frac32.1%
*-commutative32.1%
associate-/r*32.1%
associate-*l/32.2%
Simplified33.0%
Taylor expanded in b around inf 67.2%
Final simplification67.8%
(FPCore (a b c) :precision binary64 (if (<= b 2.4e-303) (/ b (/ a -0.6666666666666666)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.4e-303) {
tmp = b / (a / -0.6666666666666666);
} 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.4d-303) then
tmp = b / (a / (-0.6666666666666666d0))
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.4e-303) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.4e-303: tmp = b / (a / -0.6666666666666666) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.4e-303) tmp = Float64(b / Float64(a / -0.6666666666666666)); 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.4e-303) tmp = b / (a / -0.6666666666666666); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.4e-303], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.4 \cdot 10^{-303}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 2.4000000000000001e-303Initial program 72.7%
/-rgt-identity72.7%
metadata-eval72.7%
associate-/r/72.7%
metadata-eval72.7%
metadata-eval72.7%
times-frac72.7%
*-commutative72.7%
times-frac72.6%
*-commutative72.6%
associate-/r*72.5%
associate-*l/72.5%
Simplified72.4%
Taylor expanded in b around -inf 68.5%
*-commutative68.5%
Simplified68.5%
Taylor expanded in b around 0 68.5%
*-commutative68.5%
associate-/r/68.6%
Simplified68.6%
if 2.4000000000000001e-303 < b Initial program 32.2%
/-rgt-identity32.2%
metadata-eval32.2%
associate-/r/32.2%
metadata-eval32.2%
metadata-eval32.2%
times-frac32.2%
*-commutative32.2%
times-frac32.1%
*-commutative32.1%
associate-/r*32.1%
associate-*l/32.2%
Simplified33.0%
Taylor expanded in b around inf 67.2%
Final simplification67.9%
(FPCore (a b c) :precision binary64 (if (<= b 1.32e-303) (/ b (/ a -0.6666666666666666)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.32e-303) {
tmp = b / (a / -0.6666666666666666);
} 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 <= 1.32d-303) then
tmp = b / (a / (-0.6666666666666666d0))
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 <= 1.32e-303) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.32e-303: tmp = b / (a / -0.6666666666666666) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.32e-303) tmp = Float64(b / Float64(a / -0.6666666666666666)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.32e-303) tmp = b / (a / -0.6666666666666666); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.32e-303], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.32 \cdot 10^{-303}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 1.32000000000000005e-303Initial program 72.7%
/-rgt-identity72.7%
metadata-eval72.7%
associate-/r/72.7%
metadata-eval72.7%
metadata-eval72.7%
times-frac72.7%
*-commutative72.7%
times-frac72.6%
*-commutative72.6%
associate-/r*72.5%
associate-*l/72.5%
Simplified72.4%
Taylor expanded in b around -inf 68.5%
*-commutative68.5%
Simplified68.5%
Taylor expanded in b around 0 68.5%
*-commutative68.5%
associate-/r/68.6%
Simplified68.6%
if 1.32000000000000005e-303 < b Initial program 32.2%
/-rgt-identity32.2%
metadata-eval32.2%
associate-/r/32.2%
metadata-eval32.2%
metadata-eval32.2%
times-frac32.2%
*-commutative32.2%
times-frac32.1%
associate-/r*32.1%
Simplified32.9%
Taylor expanded in b around inf 19.4%
clear-num19.4%
inv-pow19.4%
Applied egg-rr19.4%
unpow-119.4%
Simplified19.4%
Taylor expanded in b around 0 67.2%
*-commutative67.2%
associate-*l/67.2%
Simplified67.2%
Final simplification67.9%
(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 52.9%
/-rgt-identity52.9%
metadata-eval52.9%
associate-/r/52.9%
metadata-eval52.9%
metadata-eval52.9%
times-frac52.9%
*-commutative52.9%
times-frac52.8%
*-commutative52.8%
associate-/r*52.8%
associate-*l/52.8%
Simplified53.2%
Taylor expanded in b around inf 34.1%
Final simplification34.1%
herbie shell --seed 2023182
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))