
(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 -2.25e+45)
(/ b (* a -1.5))
(if (<= b 8e-107)
(/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
(/ 1.0 (* b (- (* a (/ 1.5 (pow b 2.0))) (/ 2.0 c)))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.25e+45) {
tmp = b / (a * -1.5);
} else if (b <= 8e-107) {
tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = 1.0 / (b * ((a * (1.5 / pow(b, 2.0))) - (2.0 / 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 <= (-2.25d+45)) then
tmp = b / (a * (-1.5d0))
else if (b <= 8d-107) then
tmp = (sqrt(((b * b) - ((a * 3.0d0) * c))) - b) / (a * 3.0d0)
else
tmp = 1.0d0 / (b * ((a * (1.5d0 / (b ** 2.0d0))) - (2.0d0 / c)))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.25e+45) {
tmp = b / (a * -1.5);
} else if (b <= 8e-107) {
tmp = (Math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = 1.0 / (b * ((a * (1.5 / Math.pow(b, 2.0))) - (2.0 / c)));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.25e+45: tmp = b / (a * -1.5) elif b <= 8e-107: tmp = (math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0) else: tmp = 1.0 / (b * ((a * (1.5 / math.pow(b, 2.0))) - (2.0 / c))) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.25e+45) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 8e-107) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * c))) - b) / Float64(a * 3.0)); else tmp = Float64(1.0 / Float64(b * Float64(Float64(a * Float64(1.5 / (b ^ 2.0))) - Float64(2.0 / c)))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.25e+45) tmp = b / (a * -1.5); elseif (b <= 8e-107) tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0); else tmp = 1.0 / (b * ((a * (1.5 / (b ^ 2.0))) - (2.0 / c))); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.25e+45], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8e-107], 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[(1.0 / N[(b * N[(N[(a * N[(1.5 / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(2.0 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.25 \cdot 10^{+45}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 8 \cdot 10^{-107}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{2}{c}\right)}\\
\end{array}
\end{array}
if b < -2.2499999999999999e45Initial program 56.6%
sqr-neg56.6%
sqr-neg56.6%
associate-*l*56.6%
Simplified56.6%
frac-2neg56.6%
div-inv56.6%
Applied egg-rr56.6%
Taylor expanded in b around -inf 92.9%
*-commutative92.9%
associate-*l/93.0%
associate-/l*93.0%
Simplified93.0%
clear-num93.0%
un-div-inv93.1%
div-inv93.1%
metadata-eval93.1%
Applied egg-rr93.1%
if -2.2499999999999999e45 < b < 8e-107Initial program 82.0%
if 8e-107 < b Initial program 12.2%
sqr-neg12.2%
sqr-neg12.2%
associate-*l*12.2%
Simplified12.2%
prod-diff12.0%
*-commutative12.0%
associate-*r*12.0%
*-commutative12.0%
distribute-rgt-neg-in12.0%
*-commutative12.0%
distribute-rgt-neg-in12.0%
metadata-eval12.0%
*-commutative12.0%
fma-undefine12.0%
distribute-lft-neg-in12.0%
*-commutative12.0%
associate-*r*12.0%
*-commutative12.0%
distribute-rgt-neg-in12.0%
*-commutative12.0%
distribute-rgt-neg-in12.0%
metadata-eval12.0%
associate-*r*12.0%
*-commutative12.0%
associate-*l*12.0%
Applied egg-rr12.0%
clear-num12.0%
inv-pow12.0%
Applied egg-rr12.6%
Simplified12.2%
Taylor expanded in b around inf 91.7%
associate-*r/91.7%
*-commutative91.7%
*-lft-identity91.7%
times-frac91.7%
/-rgt-identity91.7%
associate-*r/91.7%
metadata-eval91.7%
Simplified91.7%
Final simplification88.8%
(FPCore (a b c)
:precision binary64
(if (<= b -2.25e+45)
(/ b (* a -1.5))
(if (<= b 8.4e-107)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* a 3.0))
(/ 1.0 (* b (- (* a (/ 1.5 (pow b 2.0))) (/ 2.0 c)))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.25e+45) {
tmp = b / (a * -1.5);
} else if (b <= 8.4e-107) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = 1.0 / (b * ((a * (1.5 / pow(b, 2.0))) - (2.0 / 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 <= (-2.25d+45)) then
tmp = b / (a * (-1.5d0))
else if (b <= 8.4d-107) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (a * 3.0d0)
else
tmp = 1.0d0 / (b * ((a * (1.5d0 / (b ** 2.0d0))) - (2.0d0 / c)))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.25e+45) {
tmp = b / (a * -1.5);
} else if (b <= 8.4e-107) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = 1.0 / (b * ((a * (1.5 / Math.pow(b, 2.0))) - (2.0 / c)));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.25e+45: tmp = b / (a * -1.5) elif b <= 8.4e-107: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0) else: tmp = 1.0 / (b * ((a * (1.5 / math.pow(b, 2.0))) - (2.0 / c))) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.25e+45) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 8.4e-107) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(a * 3.0)); else tmp = Float64(1.0 / Float64(b * Float64(Float64(a * Float64(1.5 / (b ^ 2.0))) - Float64(2.0 / c)))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.25e+45) tmp = b / (a * -1.5); elseif (b <= 8.4e-107) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0); else tmp = 1.0 / (b * ((a * (1.5 / (b ^ 2.0))) - (2.0 / c))); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.25e+45], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.4e-107], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(N[(a * N[(1.5 / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(2.0 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.25 \cdot 10^{+45}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 8.4 \cdot 10^{-107}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{2}{c}\right)}\\
\end{array}
\end{array}
if b < -2.2499999999999999e45Initial program 56.6%
sqr-neg56.6%
sqr-neg56.6%
associate-*l*56.6%
Simplified56.6%
frac-2neg56.6%
div-inv56.6%
Applied egg-rr56.6%
Taylor expanded in b around -inf 92.9%
*-commutative92.9%
associate-*l/93.0%
associate-/l*93.0%
Simplified93.0%
clear-num93.0%
un-div-inv93.1%
div-inv93.1%
metadata-eval93.1%
Applied egg-rr93.1%
if -2.2499999999999999e45 < b < 8.3999999999999997e-107Initial program 82.0%
sqr-neg82.0%
sqr-neg82.0%
associate-*l*81.9%
Simplified81.9%
if 8.3999999999999997e-107 < b Initial program 12.2%
sqr-neg12.2%
sqr-neg12.2%
associate-*l*12.2%
Simplified12.2%
prod-diff12.0%
*-commutative12.0%
associate-*r*12.0%
*-commutative12.0%
distribute-rgt-neg-in12.0%
*-commutative12.0%
distribute-rgt-neg-in12.0%
metadata-eval12.0%
*-commutative12.0%
fma-undefine12.0%
distribute-lft-neg-in12.0%
*-commutative12.0%
associate-*r*12.0%
*-commutative12.0%
distribute-rgt-neg-in12.0%
*-commutative12.0%
distribute-rgt-neg-in12.0%
metadata-eval12.0%
associate-*r*12.0%
*-commutative12.0%
associate-*l*12.0%
Applied egg-rr12.0%
clear-num12.0%
inv-pow12.0%
Applied egg-rr12.6%
Simplified12.2%
Taylor expanded in b around inf 91.7%
associate-*r/91.7%
*-commutative91.7%
*-lft-identity91.7%
times-frac91.7%
/-rgt-identity91.7%
associate-*r/91.7%
metadata-eval91.7%
Simplified91.7%
Final simplification88.8%
(FPCore (a b c)
:precision binary64
(if (<= b -2.4e-119)
(* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))
(if (<= b 6.2e-107)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(/ 1.0 (* b (- (* a (/ 1.5 (pow b 2.0))) (/ 2.0 c)))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.4e-119) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
} else if (b <= 6.2e-107) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = 1.0 / (b * ((a * (1.5 / pow(b, 2.0))) - (2.0 / 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 <= (-2.4d-119)) then
tmp = b * ((0.6666666666666666d0 * ((-1.0d0) / a)) - ((-0.5d0) * (c / (b ** 2.0d0))))
else if (b <= 6.2d-107) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
else
tmp = 1.0d0 / (b * ((a * (1.5d0 / (b ** 2.0d0))) - (2.0d0 / c)))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.4e-119) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
} else if (b <= 6.2e-107) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = 1.0 / (b * ((a * (1.5 / Math.pow(b, 2.0))) - (2.0 / c)));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.4e-119: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0)))) elif b <= 6.2e-107: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) else: tmp = 1.0 / (b * ((a * (1.5 / math.pow(b, 2.0))) - (2.0 / c))) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.4e-119) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0))))); elseif (b <= 6.2e-107) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(1.0 / Float64(b * Float64(Float64(a * Float64(1.5 / (b ^ 2.0))) - Float64(2.0 / c)))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.4e-119) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0)))); elseif (b <= 6.2e-107) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); else tmp = 1.0 / (b * ((a * (1.5 / (b ^ 2.0))) - (2.0 / c))); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.4e-119], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.2e-107], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(N[(a * N[(1.5 / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(2.0 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.4 \cdot 10^{-119}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\
\mathbf{elif}\;b \leq 6.2 \cdot 10^{-107}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{2}{c}\right)}\\
\end{array}
\end{array}
if b < -2.40000000000000009e-119Initial program 67.0%
sqr-neg67.0%
sqr-neg67.0%
associate-*l*66.9%
Simplified66.9%
Taylor expanded in b around -inf 82.4%
if -2.40000000000000009e-119 < b < 6.20000000000000043e-107Initial program 75.5%
sqr-neg75.5%
sqr-neg75.5%
associate-*l*75.5%
Simplified75.5%
Taylor expanded in b around 0 75.3%
*-commutative75.3%
*-commutative75.3%
associate-*r*75.4%
Simplified75.4%
if 6.20000000000000043e-107 < b Initial program 12.2%
sqr-neg12.2%
sqr-neg12.2%
associate-*l*12.2%
Simplified12.2%
prod-diff12.0%
*-commutative12.0%
associate-*r*12.0%
*-commutative12.0%
distribute-rgt-neg-in12.0%
*-commutative12.0%
distribute-rgt-neg-in12.0%
metadata-eval12.0%
*-commutative12.0%
fma-undefine12.0%
distribute-lft-neg-in12.0%
*-commutative12.0%
associate-*r*12.0%
*-commutative12.0%
distribute-rgt-neg-in12.0%
*-commutative12.0%
distribute-rgt-neg-in12.0%
metadata-eval12.0%
associate-*r*12.0%
*-commutative12.0%
associate-*l*12.0%
Applied egg-rr12.0%
clear-num12.0%
inv-pow12.0%
Applied egg-rr12.6%
Simplified12.2%
Taylor expanded in b around inf 91.7%
associate-*r/91.7%
*-commutative91.7%
*-lft-identity91.7%
times-frac91.7%
/-rgt-identity91.7%
associate-*r/91.7%
metadata-eval91.7%
Simplified91.7%
Final simplification84.1%
(FPCore (a b c)
:precision binary64
(if (<= b -2.05e-119)
(/ b (* a -1.5))
(if (<= b 8.4e-107)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(/ 1.0 (* b (- (* a (/ 1.5 (pow b 2.0))) (/ 2.0 c)))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.05e-119) {
tmp = b / (a * -1.5);
} else if (b <= 8.4e-107) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = 1.0 / (b * ((a * (1.5 / pow(b, 2.0))) - (2.0 / 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 <= (-2.05d-119)) then
tmp = b / (a * (-1.5d0))
else if (b <= 8.4d-107) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
else
tmp = 1.0d0 / (b * ((a * (1.5d0 / (b ** 2.0d0))) - (2.0d0 / c)))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.05e-119) {
tmp = b / (a * -1.5);
} else if (b <= 8.4e-107) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = 1.0 / (b * ((a * (1.5 / Math.pow(b, 2.0))) - (2.0 / c)));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.05e-119: tmp = b / (a * -1.5) elif b <= 8.4e-107: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) else: tmp = 1.0 / (b * ((a * (1.5 / math.pow(b, 2.0))) - (2.0 / c))) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.05e-119) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 8.4e-107) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(1.0 / Float64(b * Float64(Float64(a * Float64(1.5 / (b ^ 2.0))) - Float64(2.0 / c)))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.05e-119) tmp = b / (a * -1.5); elseif (b <= 8.4e-107) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); else tmp = 1.0 / (b * ((a * (1.5 / (b ^ 2.0))) - (2.0 / c))); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.05e-119], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.4e-107], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(N[(a * N[(1.5 / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(2.0 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.05 \cdot 10^{-119}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 8.4 \cdot 10^{-107}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{2}{c}\right)}\\
\end{array}
\end{array}
if b < -2.0500000000000001e-119Initial program 67.0%
sqr-neg67.0%
sqr-neg67.0%
associate-*l*66.9%
Simplified66.9%
frac-2neg66.9%
div-inv66.9%
Applied egg-rr66.9%
Taylor expanded in b around -inf 82.0%
*-commutative82.0%
associate-*l/82.1%
associate-/l*82.1%
Simplified82.1%
clear-num82.1%
un-div-inv82.1%
div-inv82.1%
metadata-eval82.1%
Applied egg-rr82.1%
if -2.0500000000000001e-119 < b < 8.3999999999999997e-107Initial program 75.5%
sqr-neg75.5%
sqr-neg75.5%
associate-*l*75.5%
Simplified75.5%
Taylor expanded in b around 0 75.3%
*-commutative75.3%
*-commutative75.3%
associate-*r*75.4%
Simplified75.4%
if 8.3999999999999997e-107 < b Initial program 12.2%
sqr-neg12.2%
sqr-neg12.2%
associate-*l*12.2%
Simplified12.2%
prod-diff12.0%
*-commutative12.0%
associate-*r*12.0%
*-commutative12.0%
distribute-rgt-neg-in12.0%
*-commutative12.0%
distribute-rgt-neg-in12.0%
metadata-eval12.0%
*-commutative12.0%
fma-undefine12.0%
distribute-lft-neg-in12.0%
*-commutative12.0%
associate-*r*12.0%
*-commutative12.0%
distribute-rgt-neg-in12.0%
*-commutative12.0%
distribute-rgt-neg-in12.0%
metadata-eval12.0%
associate-*r*12.0%
*-commutative12.0%
associate-*l*12.0%
Applied egg-rr12.0%
clear-num12.0%
inv-pow12.0%
Applied egg-rr12.6%
Simplified12.2%
Taylor expanded in b around inf 91.7%
associate-*r/91.7%
*-commutative91.7%
*-lft-identity91.7%
times-frac91.7%
/-rgt-identity91.7%
associate-*r/91.7%
metadata-eval91.7%
Simplified91.7%
Final simplification84.0%
(FPCore (a b c)
:precision binary64
(if (<= b -2.4e-119)
(/ b (* a -1.5))
(if (<= b 6.2e-107)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.4e-119) {
tmp = b / (a * -1.5);
} else if (b <= 6.2e-107) {
tmp = (sqrt((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 <= (-2.4d-119)) then
tmp = b / (a * (-1.5d0))
else if (b <= 6.2d-107) then
tmp = (sqrt((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 <= -2.4e-119) {
tmp = b / (a * -1.5);
} else if (b <= 6.2e-107) {
tmp = (Math.sqrt((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 <= -2.4e-119: tmp = b / (a * -1.5) elif b <= 6.2e-107: tmp = (math.sqrt((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 <= -2.4e-119) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 6.2e-107) tmp = Float64(Float64(sqrt(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 <= -2.4e-119) tmp = b / (a * -1.5); elseif (b <= 6.2e-107) tmp = (sqrt((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, -2.4e-119], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.2e-107], N[(N[(N[Sqrt[N[(c * N[(a * -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.4 \cdot 10^{-119}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 6.2 \cdot 10^{-107}:\\
\;\;\;\;\frac{\sqrt{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 < -2.40000000000000009e-119Initial program 67.0%
sqr-neg67.0%
sqr-neg67.0%
associate-*l*66.9%
Simplified66.9%
frac-2neg66.9%
div-inv66.9%
Applied egg-rr66.9%
Taylor expanded in b around -inf 82.0%
*-commutative82.0%
associate-*l/82.1%
associate-/l*82.1%
Simplified82.1%
clear-num82.1%
un-div-inv82.1%
div-inv82.1%
metadata-eval82.1%
Applied egg-rr82.1%
if -2.40000000000000009e-119 < b < 6.20000000000000043e-107Initial program 75.5%
sqr-neg75.5%
sqr-neg75.5%
associate-*l*75.5%
Simplified75.5%
Taylor expanded in b around 0 75.3%
*-commutative75.3%
*-commutative75.3%
associate-*r*75.4%
Simplified75.4%
if 6.20000000000000043e-107 < b Initial program 12.2%
sqr-neg12.2%
sqr-neg12.2%
associate-*l*12.2%
Simplified12.2%
Taylor expanded in b around inf 91.4%
*-commutative91.4%
Simplified91.4%
Final simplification83.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2.4e-119)
(/ b (* a -1.5))
(if (<= b 7.2e-107)
(/ (- (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.4e-119) {
tmp = b / (a * -1.5);
} else if (b <= 7.2e-107) {
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.4d-119)) then
tmp = b / (a * (-1.5d0))
else if (b <= 7.2d-107) 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.4e-119) {
tmp = b / (a * -1.5);
} else if (b <= 7.2e-107) {
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.4e-119: tmp = b / (a * -1.5) elif b <= 7.2e-107: 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.4e-119) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 7.2e-107) tmp = Float64(Float64(sqrt(Float64(Float64(a * 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.4e-119) tmp = b / (a * -1.5); elseif (b <= 7.2e-107) 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.4e-119], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.2e-107], N[(N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $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.4 \cdot 10^{-119}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-107}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot c\right) \cdot -3} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -2.40000000000000009e-119Initial program 67.0%
sqr-neg67.0%
sqr-neg67.0%
associate-*l*66.9%
Simplified66.9%
frac-2neg66.9%
div-inv66.9%
Applied egg-rr66.9%
Taylor expanded in b around -inf 82.0%
*-commutative82.0%
associate-*l/82.1%
associate-/l*82.1%
Simplified82.1%
clear-num82.1%
un-div-inv82.1%
div-inv82.1%
metadata-eval82.1%
Applied egg-rr82.1%
if -2.40000000000000009e-119 < b < 7.19999999999999953e-107Initial program 75.5%
sqr-neg75.5%
sqr-neg75.5%
associate-*l*75.5%
Simplified75.5%
Taylor expanded in b around 0 75.3%
if 7.19999999999999953e-107 < b Initial program 12.2%
sqr-neg12.2%
sqr-neg12.2%
associate-*l*12.2%
Simplified12.2%
Taylor expanded in b around inf 91.4%
*-commutative91.4%
Simplified91.4%
Final simplification83.9%
(FPCore (a b c)
:precision binary64
(if (<= b -4.4e-121)
(/ b (* a -1.5))
(if (<= b 5.1e-107)
(* (/ 0.3333333333333333 a) (sqrt (* a (* c -3.0))))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.4e-121) {
tmp = b / (a * -1.5);
} else if (b <= 5.1e-107) {
tmp = (0.3333333333333333 / a) * sqrt((a * (c * -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 <= (-4.4d-121)) then
tmp = b / (a * (-1.5d0))
else if (b <= 5.1d-107) then
tmp = (0.3333333333333333d0 / a) * sqrt((a * (c * (-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 <= -4.4e-121) {
tmp = b / (a * -1.5);
} else if (b <= 5.1e-107) {
tmp = (0.3333333333333333 / a) * Math.sqrt((a * (c * -3.0)));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.4e-121: tmp = b / (a * -1.5) elif b <= 5.1e-107: tmp = (0.3333333333333333 / a) * math.sqrt((a * (c * -3.0))) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.4e-121) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 5.1e-107) tmp = Float64(Float64(0.3333333333333333 / a) * sqrt(Float64(a * Float64(c * -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 <= -4.4e-121) tmp = b / (a * -1.5); elseif (b <= 5.1e-107) tmp = (0.3333333333333333 / a) * sqrt((a * (c * -3.0))); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.4e-121], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.1e-107], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.4 \cdot 10^{-121}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 5.1 \cdot 10^{-107}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \sqrt{a \cdot \left(c \cdot -3\right)}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -4.40000000000000042e-121Initial program 67.0%
sqr-neg67.0%
sqr-neg67.0%
associate-*l*66.9%
Simplified66.9%
frac-2neg66.9%
div-inv66.9%
Applied egg-rr66.9%
Taylor expanded in b around -inf 82.0%
*-commutative82.0%
associate-*l/82.1%
associate-/l*82.1%
Simplified82.1%
clear-num82.1%
un-div-inv82.1%
div-inv82.1%
metadata-eval82.1%
Applied egg-rr82.1%
if -4.40000000000000042e-121 < b < 5.1000000000000002e-107Initial program 75.5%
sqr-neg75.5%
sqr-neg75.5%
associate-*l*75.5%
Simplified75.5%
prod-diff75.1%
*-commutative75.1%
associate-*r*75.1%
*-commutative75.1%
distribute-rgt-neg-in75.1%
*-commutative75.1%
distribute-rgt-neg-in75.1%
metadata-eval75.1%
*-commutative75.1%
fma-undefine75.1%
distribute-lft-neg-in75.1%
*-commutative75.1%
associate-*r*75.0%
*-commutative75.0%
distribute-rgt-neg-in75.0%
*-commutative75.0%
distribute-rgt-neg-in75.0%
metadata-eval75.0%
associate-*r*75.1%
*-commutative75.1%
associate-*l*75.0%
Applied egg-rr75.0%
Taylor expanded in b around 0 74.8%
associate-*r*74.9%
associate-*r/74.8%
metadata-eval74.8%
distribute-rgt-out75.2%
metadata-eval75.2%
rem-square-sqrt0.0%
unpow20.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt75.2%
Simplified75.2%
if 5.1000000000000002e-107 < b Initial program 12.2%
sqr-neg12.2%
sqr-neg12.2%
associate-*l*12.2%
Simplified12.2%
Taylor expanded in b around inf 91.4%
*-commutative91.4%
Simplified91.4%
Final simplification83.8%
(FPCore (a b c)
:precision binary64
(if (<= b -2.05e-135)
(/ b (* a -1.5))
(if (<= b 2.7e-197)
(* 0.3333333333333333 (sqrt (* -3.0 (/ c a))))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.05e-135) {
tmp = b / (a * -1.5);
} else if (b <= 2.7e-197) {
tmp = 0.3333333333333333 * sqrt((-3.0 * (c / 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 <= (-2.05d-135)) then
tmp = b / (a * (-1.5d0))
else if (b <= 2.7d-197) then
tmp = 0.3333333333333333d0 * sqrt(((-3.0d0) * (c / 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 <= -2.05e-135) {
tmp = b / (a * -1.5);
} else if (b <= 2.7e-197) {
tmp = 0.3333333333333333 * Math.sqrt((-3.0 * (c / a)));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.05e-135: tmp = b / (a * -1.5) elif b <= 2.7e-197: tmp = 0.3333333333333333 * math.sqrt((-3.0 * (c / a))) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.05e-135) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 2.7e-197) tmp = Float64(0.3333333333333333 * sqrt(Float64(-3.0 * Float64(c / 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 <= -2.05e-135) tmp = b / (a * -1.5); elseif (b <= 2.7e-197) tmp = 0.3333333333333333 * sqrt((-3.0 * (c / a))); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.05e-135], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.7e-197], N[(0.3333333333333333 * N[Sqrt[N[(-3.0 * N[(c / a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.05 \cdot 10^{-135}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 2.7 \cdot 10^{-197}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt{-3 \cdot \frac{c}{a}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -2.05000000000000005e-135Initial program 67.0%
sqr-neg67.0%
sqr-neg67.0%
associate-*l*66.9%
Simplified66.9%
frac-2neg66.9%
div-inv66.9%
Applied egg-rr66.9%
Taylor expanded in b around -inf 82.0%
*-commutative82.0%
associate-*l/82.1%
associate-/l*82.1%
Simplified82.1%
clear-num82.1%
un-div-inv82.1%
div-inv82.1%
metadata-eval82.1%
Applied egg-rr82.1%
if -2.05000000000000005e-135 < b < 2.70000000000000017e-197Initial program 81.3%
sqr-neg81.3%
sqr-neg81.3%
associate-*l*81.2%
Simplified81.2%
prod-diff80.9%
*-commutative80.9%
associate-*r*81.0%
*-commutative81.0%
distribute-rgt-neg-in81.0%
*-commutative81.0%
distribute-rgt-neg-in81.0%
metadata-eval81.0%
*-commutative81.0%
fma-undefine81.0%
distribute-lft-neg-in81.0%
*-commutative81.0%
associate-*r*80.9%
*-commutative80.9%
distribute-rgt-neg-in80.9%
*-commutative80.9%
distribute-rgt-neg-in80.9%
metadata-eval80.9%
associate-*r*81.0%
*-commutative81.0%
associate-*l*80.9%
Applied egg-rr80.9%
Taylor expanded in a around inf 36.0%
*-commutative36.0%
distribute-rgt-out36.0%
metadata-eval36.0%
Simplified36.0%
Taylor expanded in c around 0 36.1%
if 2.70000000000000017e-197 < b Initial program 22.4%
sqr-neg22.4%
sqr-neg22.4%
associate-*l*22.4%
Simplified22.4%
Taylor expanded in b around inf 78.5%
*-commutative78.5%
Simplified78.5%
Final simplification74.9%
(FPCore (a b c)
:precision binary64
(if (<= b -3e-149)
(/ b (* a -1.5))
(if (<= b 3.4e-200)
(sqrt (* (* c (/ -3.0 a)) 0.1111111111111111))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3e-149) {
tmp = b / (a * -1.5);
} else if (b <= 3.4e-200) {
tmp = sqrt(((c * (-3.0 / a)) * 0.1111111111111111));
} 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 <= (-3d-149)) then
tmp = b / (a * (-1.5d0))
else if (b <= 3.4d-200) then
tmp = sqrt(((c * ((-3.0d0) / a)) * 0.1111111111111111d0))
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 <= -3e-149) {
tmp = b / (a * -1.5);
} else if (b <= 3.4e-200) {
tmp = Math.sqrt(((c * (-3.0 / a)) * 0.1111111111111111));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3e-149: tmp = b / (a * -1.5) elif b <= 3.4e-200: tmp = math.sqrt(((c * (-3.0 / a)) * 0.1111111111111111)) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3e-149) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 3.4e-200) tmp = sqrt(Float64(Float64(c * Float64(-3.0 / a)) * 0.1111111111111111)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3e-149) tmp = b / (a * -1.5); elseif (b <= 3.4e-200) tmp = sqrt(((c * (-3.0 / a)) * 0.1111111111111111)); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3e-149], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.4e-200], N[Sqrt[N[(N[(c * N[(-3.0 / a), $MachinePrecision]), $MachinePrecision] * 0.1111111111111111), $MachinePrecision]], $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3 \cdot 10^{-149}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 3.4 \cdot 10^{-200}:\\
\;\;\;\;\sqrt{\left(c \cdot \frac{-3}{a}\right) \cdot 0.1111111111111111}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -3.0000000000000002e-149Initial program 67.2%
sqr-neg67.2%
sqr-neg67.2%
associate-*l*67.2%
Simplified67.2%
frac-2neg67.2%
div-inv67.2%
Applied egg-rr67.2%
Taylor expanded in b around -inf 81.4%
*-commutative81.4%
associate-*l/81.5%
associate-/l*81.5%
Simplified81.5%
clear-num81.4%
un-div-inv81.4%
div-inv81.5%
metadata-eval81.5%
Applied egg-rr81.5%
if -3.0000000000000002e-149 < b < 3.4000000000000003e-200Initial program 80.7%
sqr-neg80.7%
sqr-neg80.7%
associate-*l*80.6%
Simplified80.6%
prod-diff80.3%
*-commutative80.3%
associate-*r*80.3%
*-commutative80.3%
distribute-rgt-neg-in80.3%
*-commutative80.3%
distribute-rgt-neg-in80.3%
metadata-eval80.3%
*-commutative80.3%
fma-undefine80.4%
distribute-lft-neg-in80.4%
*-commutative80.4%
associate-*r*80.2%
*-commutative80.2%
distribute-rgt-neg-in80.2%
*-commutative80.2%
distribute-rgt-neg-in80.2%
metadata-eval80.2%
associate-*r*80.4%
*-commutative80.4%
associate-*l*80.2%
Applied egg-rr80.2%
Taylor expanded in a around inf 36.9%
*-commutative36.9%
distribute-rgt-out36.9%
metadata-eval36.9%
Simplified36.9%
add-sqr-sqrt36.8%
sqrt-unprod36.9%
swap-sqr36.9%
add-sqr-sqrt37.0%
associate-/l*37.0%
metadata-eval37.0%
Applied egg-rr37.0%
if 3.4000000000000003e-200 < b Initial program 22.4%
sqr-neg22.4%
sqr-neg22.4%
associate-*l*22.4%
Simplified22.4%
Taylor expanded in b around inf 78.5%
*-commutative78.5%
Simplified78.5%
Final simplification74.9%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (/ b (* a -1.5)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = b / (a * -1.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 <= (-5d-310)) then
tmp = b / (a * (-1.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 <= -5e-310) {
tmp = b / (a * -1.5);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = b / (a * -1.5) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(b / Float64(a * -1.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 <= -5e-310) tmp = b / (a * -1.5); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 69.9%
sqr-neg69.9%
sqr-neg69.9%
associate-*l*69.8%
Simplified69.8%
frac-2neg69.8%
div-inv69.7%
Applied egg-rr69.8%
Taylor expanded in b around -inf 71.8%
*-commutative71.8%
associate-*l/71.9%
associate-/l*71.9%
Simplified71.9%
clear-num71.8%
un-div-inv71.8%
div-inv71.9%
metadata-eval71.9%
Applied egg-rr71.9%
if -4.999999999999985e-310 < b Initial program 28.1%
sqr-neg28.1%
sqr-neg28.1%
associate-*l*28.1%
Simplified28.1%
Taylor expanded in b around inf 69.9%
*-commutative69.9%
Simplified69.9%
Final simplification70.9%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (* b (/ -0.6666666666666666 a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
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 <= (-5d-310)) 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 <= -5e-310) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = b * (-0.6666666666666666 / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(b * Float64(-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 <= -5e-310) tmp = b * (-0.6666666666666666 / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 69.9%
sqr-neg69.9%
sqr-neg69.9%
associate-*l*69.8%
Simplified69.8%
frac-2neg69.8%
div-inv69.7%
Applied egg-rr69.8%
Taylor expanded in b around -inf 71.8%
*-commutative71.8%
associate-*l/71.9%
associate-/l*71.9%
Simplified71.9%
if -4.999999999999985e-310 < b Initial program 28.1%
sqr-neg28.1%
sqr-neg28.1%
associate-*l*28.1%
Simplified28.1%
Taylor expanded in b around inf 69.9%
*-commutative69.9%
Simplified69.9%
Final simplification70.9%
(FPCore (a b c) :precision binary64 (if (<= b 2e-309) (* b (/ -0.6666666666666666 a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 2e-309) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 2d-309) then
tmp = b * ((-0.6666666666666666d0) / a)
else
tmp = c * ((-0.5d0) / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 2e-309) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2e-309: tmp = b * (-0.6666666666666666 / a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2e-309) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(c * Float64(-0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 2e-309) tmp = b * (-0.6666666666666666 / a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2e-309], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2 \cdot 10^{-309}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 1.9999999999999988e-309Initial program 69.9%
sqr-neg69.9%
sqr-neg69.9%
associate-*l*69.8%
Simplified69.8%
frac-2neg69.8%
div-inv69.7%
Applied egg-rr69.8%
Taylor expanded in b around -inf 71.8%
*-commutative71.8%
associate-*l/71.9%
associate-/l*71.9%
Simplified71.9%
if 1.9999999999999988e-309 < b Initial program 28.1%
sqr-neg28.1%
sqr-neg28.1%
associate-*l*28.1%
Simplified28.1%
Taylor expanded in c around 0 63.1%
Taylor expanded in a around 0 69.6%
(FPCore (a b c) :precision binary64 (if (<= b 3e+96) (* b (/ -0.6666666666666666 a)) (* (/ c b) 0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 3e+96) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c / b) * 0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 3d+96) then
tmp = b * ((-0.6666666666666666d0) / a)
else
tmp = (c / b) * 0.5d0
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 3e+96) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c / b) * 0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 3e+96: tmp = b * (-0.6666666666666666 / a) else: tmp = (c / b) * 0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 3e+96) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(Float64(c / b) * 0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 3e+96) tmp = b * (-0.6666666666666666 / a); else tmp = (c / b) * 0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 3e+96], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3 \cdot 10^{+96}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot 0.5\\
\end{array}
\end{array}
if b < 3e96Initial program 60.9%
sqr-neg60.9%
sqr-neg60.9%
associate-*l*60.8%
Simplified60.8%
frac-2neg60.8%
div-inv60.8%
Applied egg-rr60.8%
Taylor expanded in b around -inf 49.1%
*-commutative49.1%
associate-*l/49.1%
associate-/l*49.1%
Simplified49.1%
if 3e96 < b Initial program 9.9%
sqr-neg9.9%
sqr-neg9.9%
associate-*l*9.9%
Simplified9.9%
clear-num9.9%
inv-pow9.9%
Applied egg-rr1.5%
Taylor expanded in b around -inf 40.3%
Final simplification47.3%
(FPCore (a b c) :precision binary64 (* (/ c b) 0.5))
double code(double a, double b, double c) {
return (c / b) * 0.5;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (c / b) * 0.5d0
end function
public static double code(double a, double b, double c) {
return (c / b) * 0.5;
}
def code(a, b, c): return (c / b) * 0.5
function code(a, b, c) return Float64(Float64(c / b) * 0.5) end
function tmp = code(a, b, c) tmp = (c / b) * 0.5; end
code[a_, b_, c_] := N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{c}{b} \cdot 0.5
\end{array}
Initial program 50.3%
sqr-neg50.3%
sqr-neg50.3%
associate-*l*50.3%
Simplified50.3%
clear-num50.2%
inv-pow50.2%
Applied egg-rr30.4%
Taylor expanded in b around -inf 10.6%
Final simplification10.6%
herbie shell --seed 2024131
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))