
(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 15 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 -1.2e+159)
(/ b (* a -1.5))
(if (<= b 1.45e-102)
(/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
(if (or (<= b 1.25e-38) (not (<= b 5100000.0)))
(/ (* c -0.5) b)
(/ (+ b (hypot b (* (sqrt (* a -3.0)) (sqrt c)))) (* a 3.0))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.2e+159) {
tmp = b / (a * -1.5);
} else if (b <= 1.45e-102) {
tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else if ((b <= 1.25e-38) || !(b <= 5100000.0)) {
tmp = (c * -0.5) / b;
} else {
tmp = (b + hypot(b, (sqrt((a * -3.0)) * sqrt(c)))) / (a * 3.0);
}
return tmp;
}
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.2e+159) {
tmp = b / (a * -1.5);
} else if (b <= 1.45e-102) {
tmp = (Math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else if ((b <= 1.25e-38) || !(b <= 5100000.0)) {
tmp = (c * -0.5) / b;
} else {
tmp = (b + Math.hypot(b, (Math.sqrt((a * -3.0)) * Math.sqrt(c)))) / (a * 3.0);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.2e+159: tmp = b / (a * -1.5) elif b <= 1.45e-102: tmp = (math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0) elif (b <= 1.25e-38) or not (b <= 5100000.0): tmp = (c * -0.5) / b else: tmp = (b + math.hypot(b, (math.sqrt((a * -3.0)) * math.sqrt(c)))) / (a * 3.0) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.2e+159) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 1.45e-102) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * c))) - b) / Float64(a * 3.0)); elseif ((b <= 1.25e-38) || !(b <= 5100000.0)) tmp = Float64(Float64(c * -0.5) / b); else tmp = Float64(Float64(b + hypot(b, Float64(sqrt(Float64(a * -3.0)) * sqrt(c)))) / Float64(a * 3.0)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.2e+159) tmp = b / (a * -1.5); elseif (b <= 1.45e-102) tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0); elseif ((b <= 1.25e-38) || ~((b <= 5100000.0))) tmp = (c * -0.5) / b; else tmp = (b + hypot(b, (sqrt((a * -3.0)) * sqrt(c)))) / (a * 3.0); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.2e+159], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.45e-102], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(a * 3.0), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 1.25e-38], N[Not[LessEqual[b, 5100000.0]], $MachinePrecision]], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision], N[(N[(b + N[Sqrt[b ^ 2 + N[(N[Sqrt[N[(a * -3.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[c], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.2 \cdot 10^{+159}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 1.45 \cdot 10^{-102}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 1.25 \cdot 10^{-38} \lor \neg \left(b \leq 5100000\right):\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + \mathsf{hypot}\left(b, \sqrt{a \cdot -3} \cdot \sqrt{c}\right)}{a \cdot 3}\\
\end{array}
\end{array}
if b < -1.2e159Initial program 56.7%
Applied egg-rr51.7%
sub-neg51.7%
Applied egg-rr51.7%
unsub-neg51.7%
distribute-rgt-out--51.7%
associate-*r*51.7%
*-commutative51.7%
associate-*r*51.7%
Simplified51.7%
Taylor expanded in b around -inf 99.7%
*-commutative99.7%
metadata-eval99.7%
times-frac99.9%
*-rgt-identity99.9%
Simplified99.9%
if -1.2e159 < b < 1.44999999999999993e-102Initial program 83.3%
if 1.44999999999999993e-102 < b < 1.25000000000000008e-38 or 5.1e6 < b Initial program 13.7%
Taylor expanded in b around inf 89.0%
associate-*r/89.0%
Simplified89.0%
if 1.25000000000000008e-38 < b < 5.1e6Initial program 39.1%
+-commutative39.1%
sqr-neg39.1%
unsub-neg39.1%
div-sub39.1%
--rgt-identity39.1%
div-sub39.1%
Simplified39.1%
sub-neg39.1%
fma-udef39.1%
add-sqr-sqrt39.1%
hypot-def39.1%
associate-*r*39.1%
*-commutative39.1%
metadata-eval39.1%
distribute-lft-neg-in39.1%
associate-*l*39.1%
*-commutative39.1%
distribute-rgt-neg-in39.1%
*-commutative39.1%
distribute-rgt-neg-in39.1%
metadata-eval39.1%
add-sqr-sqrt0.0%
sqrt-unprod39.2%
sqr-neg39.2%
sqrt-prod39.2%
add-sqr-sqrt39.2%
Applied egg-rr39.2%
*-commutative39.2%
sqrt-prod75.2%
Applied egg-rr75.2%
Final simplification87.3%
(FPCore (a b c)
:precision binary64
(if (<= b -1.2e+159)
(/ b (* a -1.5))
(if (<= b 1.95e-103)
(/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.2e+159) {
tmp = b / (a * -1.5);
} else if (b <= 1.95e-103) {
tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - 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 <= (-1.2d+159)) then
tmp = b / (a * (-1.5d0))
else if (b <= 1.95d-103) then
tmp = (sqrt(((b * b) - ((a * 3.0d0) * c))) - 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 <= -1.2e+159) {
tmp = b / (a * -1.5);
} else if (b <= 1.95e-103) {
tmp = (Math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.2e+159: tmp = b / (a * -1.5) elif b <= 1.95e-103: tmp = (math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.2e+159) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 1.95e-103) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * c))) - 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 <= -1.2e+159) tmp = b / (a * -1.5); elseif (b <= 1.95e-103) tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.2e+159], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.95e-103], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(a * 3.0), $MachinePrecision] * c), $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.2 \cdot 10^{+159}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 1.95 \cdot 10^{-103}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.2e159Initial program 56.7%
Applied egg-rr51.7%
sub-neg51.7%
Applied egg-rr51.7%
unsub-neg51.7%
distribute-rgt-out--51.7%
associate-*r*51.7%
*-commutative51.7%
associate-*r*51.7%
Simplified51.7%
Taylor expanded in b around -inf 99.7%
*-commutative99.7%
metadata-eval99.7%
times-frac99.9%
*-rgt-identity99.9%
Simplified99.9%
if -1.2e159 < b < 1.9500000000000001e-103Initial program 83.3%
if 1.9500000000000001e-103 < b Initial program 15.6%
Taylor expanded in b around inf 83.7%
associate-*r/83.7%
Simplified83.7%
Final simplification85.5%
(FPCore (a b c)
:precision binary64
(if (<= b -1.02e-47)
(/ (- (- (/ (* a 1.5) (/ b c)) b) b) (* a 3.0))
(if (<= b 3.4e-102)
(* (/ 0.3333333333333333 a) (+ b (sqrt (* c (* a -3.0)))))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.02e-47) {
tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 3.4e-102) {
tmp = (0.3333333333333333 / a) * (b + sqrt((c * (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.02d-47)) then
tmp = ((((a * 1.5d0) / (b / c)) - b) - b) / (a * 3.0d0)
else if (b <= 3.4d-102) then
tmp = (0.3333333333333333d0 / a) * (b + sqrt((c * (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.02e-47) {
tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 3.4e-102) {
tmp = (0.3333333333333333 / a) * (b + Math.sqrt((c * (a * -3.0))));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.02e-47: tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0) elif b <= 3.4e-102: tmp = (0.3333333333333333 / a) * (b + math.sqrt((c * (a * -3.0)))) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.02e-47) tmp = Float64(Float64(Float64(Float64(Float64(a * 1.5) / Float64(b / c)) - b) - b) / Float64(a * 3.0)); elseif (b <= 3.4e-102) tmp = Float64(Float64(0.3333333333333333 / a) * Float64(b + sqrt(Float64(c * 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.02e-47) tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0); elseif (b <= 3.4e-102) tmp = (0.3333333333333333 / a) * (b + sqrt((c * (a * -3.0)))); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.02e-47], N[(N[(N[(N[(N[(a * 1.5), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.4e-102], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(b + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.02 \cdot 10^{-47}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 3.4 \cdot 10^{-102}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(b + \sqrt{c \cdot \left(a \cdot -3\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.02000000000000002e-47Initial program 79.7%
Taylor expanded in b around -inf 81.2%
+-commutative81.2%
mul-1-neg81.2%
unsub-neg81.2%
associate-/l*83.7%
associate-*r/83.7%
Simplified83.7%
if -1.02000000000000002e-47 < b < 3.40000000000000013e-102Initial program 75.5%
Taylor expanded in b around 0 70.3%
*-commutative70.3%
associate-*l*70.5%
Simplified70.5%
*-un-lft-identity70.5%
*-commutative70.5%
times-frac70.2%
div-inv70.3%
+-commutative70.3%
sqrt-prod47.5%
fma-def47.5%
add-sqr-sqrt21.0%
sqrt-unprod46.6%
sqr-neg46.6%
sqrt-unprod25.6%
add-sqr-sqrt46.3%
metadata-eval46.3%
Applied egg-rr46.3%
expm1-log1p-u45.0%
expm1-udef22.4%
associate-*r*22.4%
*-commutative22.4%
associate-*l/22.4%
*-un-lft-identity22.4%
fma-udef22.4%
+-commutative22.4%
sqrt-unprod16.2%
Applied egg-rr16.2%
expm1-def43.8%
expm1-log1p68.9%
associate-*r/68.9%
associate-*l/69.0%
associate-*r*68.8%
*-commutative68.8%
associate-*l*69.0%
Simplified69.0%
if 3.40000000000000013e-102 < b Initial program 15.6%
Taylor expanded in b around inf 83.7%
associate-*r/83.7%
Simplified83.7%
Final simplification79.8%
(FPCore (a b c)
:precision binary64
(if (<= b -4.5e-48)
(/ (- (- (/ (* a 1.5) (/ b c)) b) b) (* a 3.0))
(if (<= b 8.3e-103)
(/ (+ b (sqrt (* a (* c -3.0)))) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.5e-48) {
tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 8.3e-103) {
tmp = (b + sqrt((a * (c * -3.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 <= (-4.5d-48)) then
tmp = ((((a * 1.5d0) / (b / c)) - b) - b) / (a * 3.0d0)
else if (b <= 8.3d-103) then
tmp = (b + sqrt((a * (c * (-3.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 <= -4.5e-48) {
tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 8.3e-103) {
tmp = (b + Math.sqrt((a * (c * -3.0)))) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.5e-48: tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0) elif b <= 8.3e-103: tmp = (b + math.sqrt((a * (c * -3.0)))) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.5e-48) tmp = Float64(Float64(Float64(Float64(Float64(a * 1.5) / Float64(b / c)) - b) - b) / Float64(a * 3.0)); elseif (b <= 8.3e-103) tmp = Float64(Float64(b + sqrt(Float64(a * Float64(c * -3.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 <= -4.5e-48) tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0); elseif (b <= 8.3e-103) tmp = (b + sqrt((a * (c * -3.0)))) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.5e-48], N[(N[(N[(N[(N[(a * 1.5), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.3e-103], N[(N[(b + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $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 -4.5 \cdot 10^{-48}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 8.3 \cdot 10^{-103}:\\
\;\;\;\;\frac{b + \sqrt{a \cdot \left(c \cdot -3\right)}}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.49999999999999988e-48Initial program 79.7%
Taylor expanded in b around -inf 81.2%
+-commutative81.2%
mul-1-neg81.2%
unsub-neg81.2%
associate-/l*83.7%
associate-*r/83.7%
Simplified83.7%
if -4.49999999999999988e-48 < b < 8.30000000000000006e-103Initial program 75.5%
Taylor expanded in b around 0 70.3%
*-commutative70.3%
associate-*l*70.5%
Simplified70.5%
*-un-lft-identity70.5%
*-commutative70.5%
times-frac70.2%
div-inv70.3%
+-commutative70.3%
sqrt-prod47.5%
fma-def47.5%
add-sqr-sqrt21.0%
sqrt-unprod46.6%
sqr-neg46.6%
sqrt-unprod25.6%
add-sqr-sqrt46.3%
metadata-eval46.3%
Applied egg-rr46.3%
associate-*l/46.4%
*-un-lft-identity46.4%
associate-/l*46.2%
fma-udef46.2%
+-commutative46.2%
sqrt-unprod68.9%
div-inv69.0%
metadata-eval69.0%
*-commutative69.0%
Applied egg-rr69.0%
if 8.30000000000000006e-103 < b Initial program 15.6%
Taylor expanded in b around inf 83.7%
associate-*r/83.7%
Simplified83.7%
Final simplification79.9%
(FPCore (a b c)
:precision binary64
(if (<= b -6e-47)
(/ (- (- (/ (* a 1.5) (/ b c)) b) b) (* a 3.0))
(if (<= b 2.95e-102)
(/ (- (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 <= -6e-47) {
tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 2.95e-102) {
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 <= (-6d-47)) then
tmp = ((((a * 1.5d0) / (b / c)) - b) - b) / (a * 3.0d0)
else if (b <= 2.95d-102) 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 <= -6e-47) {
tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 2.95e-102) {
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 <= -6e-47: tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0) elif b <= 2.95e-102: 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 <= -6e-47) tmp = Float64(Float64(Float64(Float64(Float64(a * 1.5) / Float64(b / c)) - b) - b) / Float64(a * 3.0)); elseif (b <= 2.95e-102) 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 <= -6e-47) tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0); elseif (b <= 2.95e-102) 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, -6e-47], N[(N[(N[(N[(N[(a * 1.5), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.95e-102], 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 -6 \cdot 10^{-47}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 2.95 \cdot 10^{-102}:\\
\;\;\;\;\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 < -6.00000000000000033e-47Initial program 79.7%
Taylor expanded in b around -inf 81.2%
+-commutative81.2%
mul-1-neg81.2%
unsub-neg81.2%
associate-/l*83.7%
associate-*r/83.7%
Simplified83.7%
if -6.00000000000000033e-47 < b < 2.9500000000000001e-102Initial program 75.5%
Taylor expanded in b around 0 70.3%
*-commutative70.3%
associate-*l*70.5%
Simplified70.5%
if 2.9500000000000001e-102 < b Initial program 15.6%
Taylor expanded in b around inf 83.7%
associate-*r/83.7%
Simplified83.7%
Final simplification80.3%
(FPCore (a b c)
:precision binary64
(if (<= b -8.8e-48)
(/ (- (- (/ (* a 1.5) (/ b c)) b) b) (* a 3.0))
(if (<= b 1.35e-103)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -8.8e-48) {
tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 1.35e-103) {
tmp = (sqrt((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 <= (-8.8d-48)) then
tmp = ((((a * 1.5d0) / (b / c)) - b) - b) / (a * 3.0d0)
else if (b <= 1.35d-103) then
tmp = (sqrt((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 <= -8.8e-48) {
tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= 1.35e-103) {
tmp = (Math.sqrt((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 <= -8.8e-48: tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0) elif b <= 1.35e-103: tmp = (math.sqrt((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 <= -8.8e-48) tmp = Float64(Float64(Float64(Float64(Float64(a * 1.5) / Float64(b / c)) - b) - b) / Float64(a * 3.0)); elseif (b <= 1.35e-103) tmp = Float64(Float64(sqrt(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 <= -8.8e-48) tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0); elseif (b <= 1.35e-103) tmp = (sqrt((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, -8.8e-48], N[(N[(N[(N[(N[(a * 1.5), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.35e-103], N[(N[(N[Sqrt[N[(c * N[(a * -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 -8.8 \cdot 10^{-48}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 1.35 \cdot 10^{-103}:\\
\;\;\;\;\frac{\sqrt{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 < -8.8000000000000005e-48Initial program 79.7%
Taylor expanded in b around -inf 81.2%
+-commutative81.2%
mul-1-neg81.2%
unsub-neg81.2%
associate-/l*83.7%
associate-*r/83.7%
Simplified83.7%
if -8.8000000000000005e-48 < b < 1.35000000000000005e-103Initial program 75.5%
Taylor expanded in b around 0 70.3%
associate-*r*70.6%
*-commutative70.6%
*-commutative70.6%
Simplified70.6%
if 1.35000000000000005e-103 < b Initial program 15.6%
Taylor expanded in b around inf 83.7%
associate-*r/83.7%
Simplified83.7%
Final simplification80.3%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (/ (- (- (/ (* a 1.5) (/ b c)) b) b) (* a 3.0)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = ((((a * 1.5) / (b / c)) - b) - 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 <= (-5d-310)) then
tmp = ((((a * 1.5d0) / (b / c)) - b) - 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 <= -5e-310) {
tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(Float64(Float64(Float64(Float64(a * 1.5) / Float64(b / c)) - b) - 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 <= -5e-310) tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(N[(N[(N[(N[(a * 1.5), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $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 -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 81.4%
Taylor expanded in b around -inf 62.0%
+-commutative62.0%
mul-1-neg62.0%
unsub-neg62.0%
associate-/l*63.7%
associate-*r/63.7%
Simplified63.7%
if -4.999999999999985e-310 < b Initial program 27.2%
Taylor expanded in b around inf 66.0%
associate-*r/66.0%
Simplified66.0%
Final simplification65.0%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} 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 <= (-5d-310)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
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 <= -5e-310) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 81.4%
Taylor expanded in b around -inf 63.5%
if -4.999999999999985e-310 < b Initial program 27.2%
Taylor expanded in b around inf 66.0%
associate-*r/66.0%
Simplified66.0%
Final simplification64.9%
(FPCore (a b c) :precision binary64 (if (<= b 2.9e+19) (* -0.6666666666666666 (/ b a)) (* c (/ 0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.9e+19) {
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 <= 2.9d+19) 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 <= 2.9e+19) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = c * (0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.9e+19: tmp = -0.6666666666666666 * (b / a) else: tmp = c * (0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.9e+19) 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 <= 2.9e+19) tmp = -0.6666666666666666 * (b / a); else tmp = c * (0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.9e+19], 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 2.9 \cdot 10^{+19}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{0.5}{b}\\
\end{array}
\end{array}
if b < 2.9e19Initial program 72.4%
Taylor expanded in b around -inf 42.5%
*-commutative42.5%
Simplified42.5%
if 2.9e19 < b Initial program 6.5%
Taylor expanded in b around -inf 2.4%
Taylor expanded in b around 0 24.1%
associate-*r/24.1%
associate-/l*24.1%
associate-/r/24.1%
Simplified24.1%
Final simplification36.7%
(FPCore (a b c) :precision binary64 (if (<= b 8e+21) (/ -0.6666666666666666 (/ a b)) (* c (/ 0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 8e+21) {
tmp = -0.6666666666666666 / (a / b);
} 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 <= 8d+21) then
tmp = (-0.6666666666666666d0) / (a / b)
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 <= 8e+21) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = c * (0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 8e+21: tmp = -0.6666666666666666 / (a / b) else: tmp = c * (0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 8e+21) tmp = Float64(-0.6666666666666666 / Float64(a / b)); else tmp = Float64(c * Float64(0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 8e+21) tmp = -0.6666666666666666 / (a / b); else tmp = c * (0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 8e+21], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(c * N[(0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8 \cdot 10^{+21}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{0.5}{b}\\
\end{array}
\end{array}
if b < 8e21Initial program 72.4%
Taylor expanded in b around -inf 42.5%
*-commutative42.5%
Simplified42.5%
*-commutative42.5%
clear-num42.6%
un-div-inv42.6%
Applied egg-rr42.6%
if 8e21 < b Initial program 6.5%
Taylor expanded in b around -inf 2.4%
Taylor expanded in b around 0 24.1%
associate-*r/24.1%
associate-/l*24.1%
associate-/r/24.1%
Simplified24.1%
Final simplification36.7%
(FPCore (a b c) :precision binary64 (if (<= b 5.2e-281) (/ -0.6666666666666666 (/ a b)) (/ -0.5 (/ b c))))
double code(double a, double b, double c) {
double tmp;
if (b <= 5.2e-281) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = -0.5 / (b / c);
}
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.2d-281) then
tmp = (-0.6666666666666666d0) / (a / b)
else
tmp = (-0.5d0) / (b / c)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 5.2e-281) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = -0.5 / (b / c);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5.2e-281: tmp = -0.6666666666666666 / (a / b) else: tmp = -0.5 / (b / c) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 5.2e-281) tmp = Float64(-0.6666666666666666 / Float64(a / b)); else tmp = Float64(-0.5 / Float64(b / c)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 5.2e-281) tmp = -0.6666666666666666 / (a / b); else tmp = -0.5 / (b / c); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 5.2e-281], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(-0.5 / N[(b / c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.2 \cdot 10^{-281}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{\frac{b}{c}}\\
\end{array}
\end{array}
if b < 5.2000000000000001e-281Initial program 80.1%
Taylor expanded in b around -inf 62.1%
*-commutative62.1%
Simplified62.1%
*-commutative62.1%
clear-num62.2%
un-div-inv62.2%
Applied egg-rr62.2%
if 5.2000000000000001e-281 < b Initial program 27.5%
Taylor expanded in b around inf 66.9%
associate-*r/66.9%
associate-/l*64.9%
Simplified64.9%
Final simplification63.7%
(FPCore (a b c) :precision binary64 (if (<= b 5.2e-281) (/ b (* a -1.5)) (/ -0.5 (/ b c))))
double code(double a, double b, double c) {
double tmp;
if (b <= 5.2e-281) {
tmp = b / (a * -1.5);
} else {
tmp = -0.5 / (b / c);
}
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.2d-281) then
tmp = b / (a * (-1.5d0))
else
tmp = (-0.5d0) / (b / c)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 5.2e-281) {
tmp = b / (a * -1.5);
} else {
tmp = -0.5 / (b / c);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5.2e-281: tmp = b / (a * -1.5) else: tmp = -0.5 / (b / c) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 5.2e-281) tmp = Float64(b / Float64(a * -1.5)); else tmp = Float64(-0.5 / Float64(b / c)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 5.2e-281) tmp = b / (a * -1.5); else tmp = -0.5 / (b / c); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 5.2e-281], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], N[(-0.5 / N[(b / c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.2 \cdot 10^{-281}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{\frac{b}{c}}\\
\end{array}
\end{array}
if b < 5.2000000000000001e-281Initial program 80.1%
Applied egg-rr66.6%
sub-neg66.6%
Applied egg-rr66.6%
unsub-neg66.6%
distribute-rgt-out--66.6%
associate-*r*66.6%
*-commutative66.6%
associate-*r*66.6%
Simplified66.6%
Taylor expanded in b around -inf 62.1%
*-commutative62.1%
metadata-eval62.1%
times-frac62.4%
*-rgt-identity62.4%
Simplified62.4%
if 5.2000000000000001e-281 < b Initial program 27.5%
Taylor expanded in b around inf 66.9%
associate-*r/66.9%
associate-/l*64.9%
Simplified64.9%
Final simplification63.8%
(FPCore (a b c) :precision binary64 (if (<= b 5.2e-281) (/ b (* a -1.5)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 5.2e-281) {
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.2d-281) 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.2e-281) {
tmp = b / (a * -1.5);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5.2e-281: tmp = b / (a * -1.5) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 5.2e-281) 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.2e-281) tmp = b / (a * -1.5); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 5.2e-281], 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.2 \cdot 10^{-281}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 5.2000000000000001e-281Initial program 80.1%
Applied egg-rr66.6%
sub-neg66.6%
Applied egg-rr66.6%
unsub-neg66.6%
distribute-rgt-out--66.6%
associate-*r*66.6%
*-commutative66.6%
associate-*r*66.6%
Simplified66.6%
Taylor expanded in b around -inf 62.1%
*-commutative62.1%
metadata-eval62.1%
times-frac62.4%
*-rgt-identity62.4%
Simplified62.4%
if 5.2000000000000001e-281 < b Initial program 27.5%
Taylor expanded in b around inf 66.9%
associate-*r/66.9%
Simplified66.9%
Final simplification64.8%
(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 51.5%
Taylor expanded in b around -inf 29.7%
Taylor expanded in b around 0 9.8%
Final simplification9.8%
(FPCore (a b c) :precision binary64 (* c (/ 0.5 b)))
double code(double a, double b, double c) {
return c * (0.5 / b);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = c * (0.5d0 / b)
end function
public static double code(double a, double b, double c) {
return c * (0.5 / b);
}
def code(a, b, c): return c * (0.5 / b)
function code(a, b, c) return Float64(c * Float64(0.5 / b)) end
function tmp = code(a, b, c) tmp = c * (0.5 / b); end
code[a_, b_, c_] := N[(c * N[(0.5 / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c \cdot \frac{0.5}{b}
\end{array}
Initial program 51.5%
Taylor expanded in b around -inf 29.7%
Taylor expanded in b around 0 9.8%
associate-*r/9.8%
associate-/l*9.8%
associate-/r/9.8%
Simplified9.8%
Final simplification9.8%
herbie shell --seed 2024027
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))