
(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 -6.8e+137)
(/ b (* a -1.5))
(if (<= b 9.2e-70)
(/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6.8e+137) {
tmp = b / (a * -1.5);
} else if (b <= 9.2e-70) {
tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} 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 <= (-6.8d+137)) then
tmp = b / (a * (-1.5d0))
else if (b <= 9.2d-70) then
tmp = (sqrt(((b * b) - ((a * 3.0d0) * c))) - b) / (a * 3.0d0)
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 <= -6.8e+137) {
tmp = b / (a * -1.5);
} else if (b <= 9.2e-70) {
tmp = (Math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6.8e+137: tmp = b / (a * -1.5) elif b <= 9.2e-70: tmp = (math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6.8e+137) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 9.2e-70) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * c))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -6.8e+137) tmp = b / (a * -1.5); elseif (b <= 9.2e-70) tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6.8e+137], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9.2e-70], 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 / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.8 \cdot 10^{+137}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 9.2 \cdot 10^{-70}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -6.79999999999999973e137Initial program 38.3%
sqr-neg38.3%
sqr-neg38.3%
associate-*l*38.3%
Simplified38.3%
frac-2neg38.3%
div-inv38.3%
Applied egg-rr38.3%
associate-*r/38.3%
*-rgt-identity38.3%
*-commutative38.3%
metadata-eval38.3%
distribute-lft-neg-in38.3%
distribute-neg-frac238.3%
distribute-neg-frac38.3%
neg-mul-138.3%
times-frac38.3%
metadata-eval38.3%
fma-undefine38.3%
unpow238.3%
+-commutative38.3%
fma-define38.5%
Simplified38.5%
Taylor expanded in b around -inf 97.9%
associate-*r/97.8%
*-commutative97.8%
associate-/l*98.0%
Simplified98.0%
clear-num98.0%
un-div-inv98.1%
div-inv98.2%
metadata-eval98.2%
Applied egg-rr98.2%
if -6.79999999999999973e137 < b < 9.20000000000000002e-70Initial program 77.2%
if 9.20000000000000002e-70 < b Initial program 14.7%
sqr-neg14.7%
sqr-neg14.7%
associate-*l*14.7%
Simplified14.7%
Taylor expanded in b around inf 92.9%
*-commutative92.9%
Simplified92.9%
Final simplification87.2%
(FPCore (a b c)
:precision binary64
(if (<= b -1e+139)
(/ b (* a -1.5))
(if (<= b 3.8e-70)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e+139) {
tmp = b / (a * -1.5);
} else if (b <= 3.8e-70) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} 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 <= (-1d+139)) then
tmp = b / (a * (-1.5d0))
else if (b <= 3.8d-70) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (a * 3.0d0)
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 <= -1e+139) {
tmp = b / (a * -1.5);
} else if (b <= 3.8e-70) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e+139: tmp = b / (a * -1.5) elif b <= 3.8e-70: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e+139) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 3.8e-70) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e+139) tmp = b / (a * -1.5); elseif (b <= 3.8e-70) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e+139], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.8e-70], 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[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{+139}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{-70}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.00000000000000003e139Initial program 38.3%
sqr-neg38.3%
sqr-neg38.3%
associate-*l*38.3%
Simplified38.3%
frac-2neg38.3%
div-inv38.3%
Applied egg-rr38.3%
associate-*r/38.3%
*-rgt-identity38.3%
*-commutative38.3%
metadata-eval38.3%
distribute-lft-neg-in38.3%
distribute-neg-frac238.3%
distribute-neg-frac38.3%
neg-mul-138.3%
times-frac38.3%
metadata-eval38.3%
fma-undefine38.3%
unpow238.3%
+-commutative38.3%
fma-define38.5%
Simplified38.5%
Taylor expanded in b around -inf 97.9%
associate-*r/97.8%
*-commutative97.8%
associate-/l*98.0%
Simplified98.0%
clear-num98.0%
un-div-inv98.1%
div-inv98.2%
metadata-eval98.2%
Applied egg-rr98.2%
if -1.00000000000000003e139 < b < 3.7999999999999998e-70Initial program 77.2%
sqr-neg77.2%
sqr-neg77.2%
associate-*l*77.1%
Simplified77.1%
if 3.7999999999999998e-70 < b Initial program 14.7%
sqr-neg14.7%
sqr-neg14.7%
associate-*l*14.7%
Simplified14.7%
Taylor expanded in b around inf 92.9%
*-commutative92.9%
Simplified92.9%
Final simplification87.1%
(FPCore (a b c)
:precision binary64
(if (<= b -2.35e-36)
(* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))
(if (<= b 3.2e-70)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.35e-36) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
} else if (b <= 3.2e-70) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} 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 <= (-2.35d-36)) then
tmp = b * ((0.6666666666666666d0 * ((-1.0d0) / a)) - ((-0.5d0) * (c / (b ** 2.0d0))))
else if (b <= 3.2d-70) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
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 <= -2.35e-36) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
} else if (b <= 3.2e-70) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.35e-36: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0)))) elif b <= 3.2e-70: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.35e-36) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0))))); elseif (b <= 3.2e-70) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.35e-36) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0)))); elseif (b <= 3.2e-70) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.35e-36], 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, 3.2e-70], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.35 \cdot 10^{-36}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\
\mathbf{elif}\;b \leq 3.2 \cdot 10^{-70}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -2.3500000000000001e-36Initial program 56.4%
sqr-neg56.4%
sqr-neg56.4%
associate-*l*56.4%
Simplified56.4%
Taylor expanded in b around -inf 86.6%
if -2.3500000000000001e-36 < b < 3.1999999999999997e-70Initial program 73.9%
sqr-neg73.9%
sqr-neg73.9%
associate-*l*73.7%
Simplified73.7%
Taylor expanded in b around 0 65.5%
*-commutative65.5%
*-commutative65.5%
associate-*r*65.7%
Simplified65.7%
if 3.1999999999999997e-70 < b Initial program 14.7%
sqr-neg14.7%
sqr-neg14.7%
associate-*l*14.7%
Simplified14.7%
Taylor expanded in b around inf 92.9%
*-commutative92.9%
Simplified92.9%
Final simplification82.6%
(FPCore (a b c)
:precision binary64
(if (<= b -1.65e-36)
(+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5))
(if (<= b 6e-70)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.65e-36) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 6e-70) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1.65d-36)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
else if (b <= 6d-70) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.65e-36) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 6e-70) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.65e-36: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) elif b <= 6e-70: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.65e-36) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); elseif (b <= 6e-70) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.65e-36) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); elseif (b <= 6e-70) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.65e-36], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6e-70], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.65 \cdot 10^{-36}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 6 \cdot 10^{-70}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.64999999999999995e-36Initial program 56.4%
sqr-neg56.4%
sqr-neg56.4%
associate-*l*56.4%
Simplified56.4%
frac-2neg56.4%
div-inv56.5%
Applied egg-rr56.5%
associate-*r/56.4%
*-rgt-identity56.4%
*-commutative56.4%
metadata-eval56.4%
distribute-lft-neg-in56.4%
distribute-neg-frac256.4%
distribute-neg-frac56.4%
neg-mul-156.4%
times-frac56.4%
metadata-eval56.4%
fma-undefine56.4%
unpow256.4%
+-commutative56.4%
fma-define56.6%
Simplified56.6%
Taylor expanded in b around -inf 86.5%
associate-*r*86.5%
neg-mul-186.5%
associate-*r/86.5%
metadata-eval86.5%
Simplified86.5%
Taylor expanded in c around 0 86.6%
if -1.64999999999999995e-36 < b < 6.0000000000000003e-70Initial program 73.9%
sqr-neg73.9%
sqr-neg73.9%
associate-*l*73.7%
Simplified73.7%
Taylor expanded in b around 0 65.5%
*-commutative65.5%
*-commutative65.5%
associate-*r*65.7%
Simplified65.7%
if 6.0000000000000003e-70 < b Initial program 14.7%
sqr-neg14.7%
sqr-neg14.7%
associate-*l*14.7%
Simplified14.7%
Taylor expanded in b around inf 92.9%
*-commutative92.9%
Simplified92.9%
Final simplification82.6%
(FPCore (a b c)
:precision binary64
(if (<= b -1.85e-36)
(+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5))
(if (<= b 4.2e-70)
(/ (- (sqrt (* (* a c) -3.0)) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.85e-36) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 4.2e-70) {
tmp = (sqrt(((a * c) * -3.0)) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1.85d-36)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
else if (b <= 4.2d-70) then
tmp = (sqrt(((a * c) * (-3.0d0))) - b) / (a * 3.0d0)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.85e-36) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 4.2e-70) {
tmp = (Math.sqrt(((a * c) * -3.0)) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.85e-36: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) elif b <= 4.2e-70: tmp = (math.sqrt(((a * c) * -3.0)) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.85e-36) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); elseif (b <= 4.2e-70) tmp = Float64(Float64(sqrt(Float64(Float64(a * c) * -3.0)) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.85e-36) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); elseif (b <= 4.2e-70) tmp = (sqrt(((a * c) * -3.0)) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.85e-36], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.2e-70], N[(N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.85 \cdot 10^{-36}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 4.2 \cdot 10^{-70}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot c\right) \cdot -3} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.85000000000000001e-36Initial program 56.4%
sqr-neg56.4%
sqr-neg56.4%
associate-*l*56.4%
Simplified56.4%
frac-2neg56.4%
div-inv56.5%
Applied egg-rr56.5%
associate-*r/56.4%
*-rgt-identity56.4%
*-commutative56.4%
metadata-eval56.4%
distribute-lft-neg-in56.4%
distribute-neg-frac256.4%
distribute-neg-frac56.4%
neg-mul-156.4%
times-frac56.4%
metadata-eval56.4%
fma-undefine56.4%
unpow256.4%
+-commutative56.4%
fma-define56.6%
Simplified56.6%
Taylor expanded in b around -inf 86.5%
associate-*r*86.5%
neg-mul-186.5%
associate-*r/86.5%
metadata-eval86.5%
Simplified86.5%
Taylor expanded in c around 0 86.6%
if -1.85000000000000001e-36 < b < 4.2000000000000002e-70Initial program 73.9%
sqr-neg73.9%
sqr-neg73.9%
associate-*l*73.7%
Simplified73.7%
Taylor expanded in b around 0 65.5%
if 4.2000000000000002e-70 < b Initial program 14.7%
sqr-neg14.7%
sqr-neg14.7%
associate-*l*14.7%
Simplified14.7%
Taylor expanded in b around inf 92.9%
*-commutative92.9%
Simplified92.9%
Final simplification82.6%
(FPCore (a b c)
:precision binary64
(if (<= b -1.85e-36)
(+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5))
(if (<= b 1.55e-72)
(* 0.3333333333333333 (/ (+ b (sqrt (* c (* a -3.0)))) a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.85e-36) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 1.55e-72) {
tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1.85d-36)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
else if (b <= 1.55d-72) then
tmp = 0.3333333333333333d0 * ((b + sqrt((c * (a * (-3.0d0))))) / a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.85e-36) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 1.55e-72) {
tmp = 0.3333333333333333 * ((b + Math.sqrt((c * (a * -3.0)))) / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.85e-36: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) elif b <= 1.55e-72: tmp = 0.3333333333333333 * ((b + math.sqrt((c * (a * -3.0)))) / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.85e-36) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); elseif (b <= 1.55e-72) tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(c * Float64(a * -3.0)))) / a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.85e-36) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); elseif (b <= 1.55e-72) tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.85e-36], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.55e-72], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.85 \cdot 10^{-36}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 1.55 \cdot 10^{-72}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.85000000000000001e-36Initial program 56.4%
sqr-neg56.4%
sqr-neg56.4%
associate-*l*56.4%
Simplified56.4%
frac-2neg56.4%
div-inv56.5%
Applied egg-rr56.5%
associate-*r/56.4%
*-rgt-identity56.4%
*-commutative56.4%
metadata-eval56.4%
distribute-lft-neg-in56.4%
distribute-neg-frac256.4%
distribute-neg-frac56.4%
neg-mul-156.4%
times-frac56.4%
metadata-eval56.4%
fma-undefine56.4%
unpow256.4%
+-commutative56.4%
fma-define56.6%
Simplified56.6%
Taylor expanded in b around -inf 86.5%
associate-*r*86.5%
neg-mul-186.5%
associate-*r/86.5%
metadata-eval86.5%
Simplified86.5%
Taylor expanded in c around 0 86.6%
if -1.85000000000000001e-36 < b < 1.5499999999999999e-72Initial program 73.9%
sqr-neg73.9%
sqr-neg73.9%
associate-*l*73.7%
Simplified73.7%
*-un-lft-identity73.7%
times-frac73.6%
metadata-eval73.6%
add-sqr-sqrt41.1%
sqrt-unprod72.1%
sqr-neg72.1%
sqrt-prod31.5%
add-sqr-sqrt63.7%
fma-neg63.7%
associate-*r*63.8%
*-commutative63.8%
distribute-rgt-neg-in63.8%
*-commutative63.8%
distribute-rgt-neg-in63.8%
metadata-eval63.8%
Applied egg-rr63.8%
Taylor expanded in b around 0 63.6%
associate-*r*63.6%
*-commutative63.6%
*-commutative63.6%
Simplified63.6%
if 1.5499999999999999e-72 < b Initial program 14.7%
sqr-neg14.7%
sqr-neg14.7%
associate-*l*14.7%
Simplified14.7%
Taylor expanded in b around inf 92.9%
*-commutative92.9%
Simplified92.9%
Final simplification82.0%
(FPCore (a b c)
:precision binary64
(if (<= b -2.35e-36)
(+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5))
(if (<= b 2.9e-72)
(* 0.3333333333333333 (/ (+ b (sqrt (* (* a c) -3.0))) a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.35e-36) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 2.9e-72) {
tmp = 0.3333333333333333 * ((b + sqrt(((a * c) * -3.0))) / 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 <= (-2.35d-36)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
else if (b <= 2.9d-72) then
tmp = 0.3333333333333333d0 * ((b + sqrt(((a * c) * (-3.0d0)))) / 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 <= -2.35e-36) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 2.9e-72) {
tmp = 0.3333333333333333 * ((b + Math.sqrt(((a * c) * -3.0))) / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.35e-36: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) elif b <= 2.9e-72: tmp = 0.3333333333333333 * ((b + math.sqrt(((a * c) * -3.0))) / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.35e-36) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); elseif (b <= 2.9e-72) tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(Float64(a * c) * -3.0))) / 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 <= -2.35e-36) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); elseif (b <= 2.9e-72) tmp = 0.3333333333333333 * ((b + sqrt(((a * c) * -3.0))) / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.35e-36], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.9e-72], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.35 \cdot 10^{-36}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 2.9 \cdot 10^{-72}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{\left(a \cdot c\right) \cdot -3}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -2.3500000000000001e-36Initial program 56.4%
sqr-neg56.4%
sqr-neg56.4%
associate-*l*56.4%
Simplified56.4%
frac-2neg56.4%
div-inv56.5%
Applied egg-rr56.5%
associate-*r/56.4%
*-rgt-identity56.4%
*-commutative56.4%
metadata-eval56.4%
distribute-lft-neg-in56.4%
distribute-neg-frac256.4%
distribute-neg-frac56.4%
neg-mul-156.4%
times-frac56.4%
metadata-eval56.4%
fma-undefine56.4%
unpow256.4%
+-commutative56.4%
fma-define56.6%
Simplified56.6%
Taylor expanded in b around -inf 86.5%
associate-*r*86.5%
neg-mul-186.5%
associate-*r/86.5%
metadata-eval86.5%
Simplified86.5%
Taylor expanded in c around 0 86.6%
if -2.3500000000000001e-36 < b < 2.89999999999999998e-72Initial program 73.9%
sqr-neg73.9%
sqr-neg73.9%
associate-*l*73.7%
Simplified73.7%
*-un-lft-identity73.7%
times-frac73.6%
metadata-eval73.6%
add-sqr-sqrt41.1%
sqrt-unprod72.1%
sqr-neg72.1%
sqrt-prod31.5%
add-sqr-sqrt63.7%
fma-neg63.7%
associate-*r*63.8%
*-commutative63.8%
distribute-rgt-neg-in63.8%
*-commutative63.8%
distribute-rgt-neg-in63.8%
metadata-eval63.8%
Applied egg-rr63.8%
Taylor expanded in b around 0 63.6%
if 2.89999999999999998e-72 < b Initial program 14.7%
sqr-neg14.7%
sqr-neg14.7%
associate-*l*14.7%
Simplified14.7%
Taylor expanded in b around inf 92.9%
*-commutative92.9%
Simplified92.9%
Final simplification82.0%
(FPCore (a b c) :precision binary64 (if (<= b -1e-310) (+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else {
tmp = (c / 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 <= (-1d-310)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
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 <= -1e-310) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-310: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-310) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-310) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-310], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 63.6%
sqr-neg63.6%
sqr-neg63.6%
associate-*l*63.6%
Simplified63.6%
frac-2neg63.6%
div-inv63.6%
Applied egg-rr63.6%
associate-*r/63.6%
*-rgt-identity63.6%
*-commutative63.6%
metadata-eval63.6%
distribute-lft-neg-in63.6%
distribute-neg-frac263.6%
distribute-neg-frac63.6%
neg-mul-163.6%
times-frac63.6%
metadata-eval63.6%
fma-undefine63.6%
unpow263.6%
+-commutative63.6%
fma-define63.7%
Simplified63.7%
Taylor expanded in b around -inf 67.2%
associate-*r*67.2%
neg-mul-167.2%
associate-*r/67.2%
metadata-eval67.2%
Simplified67.2%
Taylor expanded in c around 0 68.1%
if -9.999999999999969e-311 < b Initial program 30.0%
sqr-neg30.0%
sqr-neg30.0%
associate-*l*30.0%
Simplified30.0%
Taylor expanded in b around inf 70.2%
*-commutative70.2%
Simplified70.2%
Final simplification69.1%
(FPCore (a b c) :precision binary64 (if (<= b 9.5e-273) (/ b (* a -1.5)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 9.5e-273) {
tmp = b / (a * -1.5);
} 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 <= 9.5d-273) then
tmp = b / (a * (-1.5d0))
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 <= 9.5e-273) {
tmp = b / (a * -1.5);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 9.5e-273: tmp = b / (a * -1.5) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 9.5e-273) tmp = Float64(b / Float64(a * -1.5)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 9.5e-273) tmp = b / (a * -1.5); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 9.5e-273], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 9.5 \cdot 10^{-273}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 9.49999999999999925e-273Initial program 62.7%
sqr-neg62.7%
sqr-neg62.7%
associate-*l*62.7%
Simplified62.7%
frac-2neg62.7%
div-inv62.7%
Applied egg-rr62.7%
associate-*r/62.7%
*-rgt-identity62.7%
*-commutative62.7%
metadata-eval62.7%
distribute-lft-neg-in62.7%
distribute-neg-frac262.7%
distribute-neg-frac62.7%
neg-mul-162.7%
times-frac62.7%
metadata-eval62.7%
fma-undefine62.7%
unpow262.7%
+-commutative62.7%
fma-define62.8%
Simplified62.8%
Taylor expanded in b around -inf 66.9%
associate-*r/66.9%
*-commutative66.9%
associate-/l*67.0%
Simplified67.0%
clear-num67.0%
un-div-inv67.0%
div-inv67.0%
metadata-eval67.0%
Applied egg-rr67.0%
if 9.49999999999999925e-273 < b Initial program 30.5%
sqr-neg30.5%
sqr-neg30.5%
associate-*l*30.4%
Simplified30.4%
Taylor expanded in b around inf 71.3%
*-commutative71.3%
Simplified71.3%
(FPCore (a b c) :precision binary64 (if (<= b 9.5e-273) (* b (/ -0.6666666666666666 a)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 9.5e-273) {
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 <= 9.5d-273) 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 <= 9.5e-273) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 9.5e-273: tmp = b * (-0.6666666666666666 / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 9.5e-273) 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 <= 9.5e-273) tmp = b * (-0.6666666666666666 / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 9.5e-273], 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 9.5 \cdot 10^{-273}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 9.49999999999999925e-273Initial program 62.7%
sqr-neg62.7%
sqr-neg62.7%
associate-*l*62.7%
Simplified62.7%
frac-2neg62.7%
div-inv62.7%
Applied egg-rr62.7%
associate-*r/62.7%
*-rgt-identity62.7%
*-commutative62.7%
metadata-eval62.7%
distribute-lft-neg-in62.7%
distribute-neg-frac262.7%
distribute-neg-frac62.7%
neg-mul-162.7%
times-frac62.7%
metadata-eval62.7%
fma-undefine62.7%
unpow262.7%
+-commutative62.7%
fma-define62.8%
Simplified62.8%
Taylor expanded in b around -inf 66.9%
associate-*r/66.9%
*-commutative66.9%
associate-/l*67.0%
Simplified67.0%
if 9.49999999999999925e-273 < b Initial program 30.5%
sqr-neg30.5%
sqr-neg30.5%
associate-*l*30.4%
Simplified30.4%
Taylor expanded in b around inf 71.3%
*-commutative71.3%
Simplified71.3%
(FPCore (a b c) :precision binary64 (if (<= b 1.25e-186) (* b (/ -0.6666666666666666 a)) 0.0))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.25e-186) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = 0.0;
}
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-186) then
tmp = b * ((-0.6666666666666666d0) / a)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.25e-186) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = 0.0;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.25e-186: tmp = b * (-0.6666666666666666 / a) else: tmp = 0.0 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.25e-186) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = 0.0; end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.25e-186) tmp = b * (-0.6666666666666666 / a); else tmp = 0.0; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.25e-186], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.25 \cdot 10^{-186}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if b < 1.25e-186Initial program 62.5%
sqr-neg62.5%
sqr-neg62.5%
associate-*l*62.4%
Simplified62.4%
frac-2neg62.4%
div-inv62.4%
Applied egg-rr62.5%
associate-*r/62.5%
*-rgt-identity62.5%
*-commutative62.5%
metadata-eval62.5%
distribute-lft-neg-in62.5%
distribute-neg-frac262.5%
distribute-neg-frac62.5%
neg-mul-162.5%
times-frac62.4%
metadata-eval62.4%
fma-undefine62.4%
unpow262.4%
+-commutative62.4%
fma-define62.5%
Simplified62.5%
Taylor expanded in b around -inf 61.0%
associate-*r/61.0%
*-commutative61.0%
associate-/l*61.0%
Simplified61.0%
if 1.25e-186 < b Initial program 26.7%
sqr-neg26.7%
sqr-neg26.7%
associate-*l*26.6%
Simplified26.6%
*-un-lft-identity26.6%
times-frac26.6%
metadata-eval26.6%
add-sqr-sqrt0.0%
sqrt-unprod18.6%
sqr-neg18.6%
sqrt-prod18.7%
add-sqr-sqrt18.7%
fma-neg18.7%
associate-*r*18.6%
*-commutative18.6%
distribute-rgt-neg-in18.6%
*-commutative18.6%
distribute-rgt-neg-in18.6%
metadata-eval18.6%
Applied egg-rr18.6%
Taylor expanded in b around inf 3.2%
Taylor expanded in b around -inf 24.0%
(FPCore (a b c) :precision binary64 0.0)
double code(double a, double b, double c) {
return 0.0;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = 0.0d0
end function
public static double code(double a, double b, double c) {
return 0.0;
}
def code(a, b, c): return 0.0
function code(a, b, c) return 0.0 end
function tmp = code(a, b, c) tmp = 0.0; end
code[a_, b_, c_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 47.2%
sqr-neg47.2%
sqr-neg47.2%
associate-*l*47.2%
Simplified47.2%
*-un-lft-identity47.2%
times-frac47.1%
metadata-eval47.1%
add-sqr-sqrt32.5%
sqrt-unprod43.6%
sqr-neg43.6%
sqrt-prod11.2%
add-sqr-sqrt30.4%
fma-neg30.4%
associate-*r*30.4%
*-commutative30.4%
distribute-rgt-neg-in30.4%
*-commutative30.4%
distribute-rgt-neg-in30.4%
metadata-eval30.4%
Applied egg-rr30.4%
Taylor expanded in b around inf 10.1%
Taylor expanded in b around -inf 11.7%
(FPCore (a b c) :precision binary64 -1.0)
double code(double a, double b, double c) {
return -1.0;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = -1.0d0
end function
public static double code(double a, double b, double c) {
return -1.0;
}
def code(a, b, c): return -1.0
function code(a, b, c) return -1.0 end
function tmp = code(a, b, c) tmp = -1.0; end
code[a_, b_, c_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 47.2%
sqr-neg47.2%
sqr-neg47.2%
associate-*l*47.2%
Simplified47.2%
*-un-lft-identity47.2%
times-frac47.1%
metadata-eval47.1%
add-sqr-sqrt32.5%
sqrt-unprod43.6%
sqr-neg43.6%
sqrt-prod11.2%
add-sqr-sqrt30.4%
fma-neg30.4%
associate-*r*30.4%
*-commutative30.4%
distribute-rgt-neg-in30.4%
*-commutative30.4%
distribute-rgt-neg-in30.4%
metadata-eval30.4%
Applied egg-rr30.4%
Taylor expanded in b around inf 10.1%
Taylor expanded in b around -inf 11.7%
Simplified3.5%
herbie shell --seed 2024090
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))