
(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 -1.35e+154)
(* b (/ -0.6666666666666666 a))
(if (<= b 3.2e-75)
(/ (- (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 <= -1.35e+154) {
tmp = b * (-0.6666666666666666 / a);
} else if (b <= 3.2e-75) {
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 <= (-1.35d+154)) then
tmp = b * ((-0.6666666666666666d0) / a)
else if (b <= 3.2d-75) 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 <= -1.35e+154) {
tmp = b * (-0.6666666666666666 / a);
} else if (b <= 3.2e-75) {
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 <= -1.35e+154: tmp = b * (-0.6666666666666666 / a) elif b <= 3.2e-75: 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 <= -1.35e+154) tmp = Float64(b * Float64(-0.6666666666666666 / a)); elseif (b <= 3.2e-75) 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 <= -1.35e+154) tmp = b * (-0.6666666666666666 / a); elseif (b <= 3.2e-75) 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, -1.35e+154], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.2e-75], 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 -1.35 \cdot 10^{+154}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 3.2 \cdot 10^{-75}:\\
\;\;\;\;\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 < -1.35000000000000003e154Initial program 44.4%
sqr-neg44.4%
sqr-neg44.4%
associate-*l*44.4%
Simplified44.4%
Taylor expanded in b around -inf 97.3%
*-commutative97.3%
Simplified97.3%
*-commutative97.3%
clear-num97.3%
un-div-inv97.3%
Applied egg-rr97.3%
associate-/r/97.4%
Simplified97.4%
if -1.35000000000000003e154 < b < 3.19999999999999977e-75Initial program 85.6%
if 3.19999999999999977e-75 < b Initial program 17.5%
sqr-neg17.5%
sqr-neg17.5%
associate-*l*17.4%
Simplified17.4%
Taylor expanded in b around inf 83.4%
*-commutative83.4%
Simplified83.4%
Final simplification86.4%
(FPCore (a b c)
:precision binary64
(if (<= b -1e+154)
(* b (/ -0.6666666666666666 a))
(if (<= b 7.2e-76)
(/ (- (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+154) {
tmp = b * (-0.6666666666666666 / a);
} else if (b <= 7.2e-76) {
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+154)) then
tmp = b * ((-0.6666666666666666d0) / a)
else if (b <= 7.2d-76) 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+154) {
tmp = b * (-0.6666666666666666 / a);
} else if (b <= 7.2e-76) {
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+154: tmp = b * (-0.6666666666666666 / a) elif b <= 7.2e-76: 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+154) tmp = Float64(b * Float64(-0.6666666666666666 / a)); elseif (b <= 7.2e-76) 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+154) tmp = b * (-0.6666666666666666 / a); elseif (b <= 7.2e-76) 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+154], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.2e-76], 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^{+154}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-76}:\\
\;\;\;\;\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.00000000000000004e154Initial program 44.4%
sqr-neg44.4%
sqr-neg44.4%
associate-*l*44.4%
Simplified44.4%
Taylor expanded in b around -inf 97.3%
*-commutative97.3%
Simplified97.3%
*-commutative97.3%
clear-num97.3%
un-div-inv97.3%
Applied egg-rr97.3%
associate-/r/97.4%
Simplified97.4%
if -1.00000000000000004e154 < b < 7.2000000000000001e-76Initial program 85.6%
sqr-neg85.6%
sqr-neg85.6%
associate-*l*85.6%
Simplified85.6%
if 7.2000000000000001e-76 < b Initial program 17.5%
sqr-neg17.5%
sqr-neg17.5%
associate-*l*17.4%
Simplified17.4%
Taylor expanded in b around inf 83.4%
*-commutative83.4%
Simplified83.4%
Final simplification86.4%
(FPCore (a b c)
:precision binary64
(if (<= b -7e-142)
(* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))
(if (<= b 5e-75)
(/ (- (sqrt (* -3.0 (* a c))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7e-142) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
} else if (b <= 5e-75) {
tmp = (sqrt((-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 <= (-7d-142)) then
tmp = b * ((0.6666666666666666d0 * ((-1.0d0) / a)) - ((-0.5d0) * (c / (b ** 2.0d0))))
else if (b <= 5d-75) then
tmp = (sqrt(((-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 <= -7e-142) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
} else if (b <= 5e-75) {
tmp = (Math.sqrt((-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 <= -7e-142: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0)))) elif b <= 5e-75: tmp = (math.sqrt((-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 <= -7e-142) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0))))); elseif (b <= 5e-75) tmp = Float64(Float64(sqrt(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 <= -7e-142) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0)))); elseif (b <= 5e-75) tmp = (sqrt((-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, -7e-142], 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, 5e-75], N[(N[(N[Sqrt[N[(-3.0 * N[(a * 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 -7 \cdot 10^{-142}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\
\mathbf{elif}\;b \leq 5 \cdot 10^{-75}:\\
\;\;\;\;\frac{\sqrt{-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 < -7.00000000000000029e-142Initial program 76.3%
sqr-neg76.3%
sqr-neg76.3%
associate-*l*76.3%
Simplified76.3%
Taylor expanded in b around -inf 92.2%
if -7.00000000000000029e-142 < b < 4.99999999999999979e-75Initial program 76.2%
sqr-neg76.2%
sqr-neg76.2%
associate-*l*76.1%
Simplified76.1%
Taylor expanded in b around 0 74.7%
*-commutative74.7%
associate-*l*74.6%
*-commutative74.6%
*-commutative74.6%
Simplified74.6%
+-commutative74.6%
unsub-neg74.6%
*-commutative74.6%
*-commutative74.6%
associate-*l*74.7%
Applied egg-rr74.7%
if 4.99999999999999979e-75 < b Initial program 17.5%
sqr-neg17.5%
sqr-neg17.5%
associate-*l*17.4%
Simplified17.4%
Taylor expanded in b around inf 83.4%
*-commutative83.4%
Simplified83.4%
Final simplification84.4%
(FPCore (a b c)
:precision binary64
(if (<= b -7e-142)
(/ b (* a -1.5))
(if (<= b 1.65e-75)
(/ (- (sqrt (* -3.0 (* a c))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7e-142) {
tmp = b / (a * -1.5);
} else if (b <= 1.65e-75) {
tmp = (sqrt((-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 <= (-7d-142)) then
tmp = b / (a * (-1.5d0))
else if (b <= 1.65d-75) then
tmp = (sqrt(((-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 <= -7e-142) {
tmp = b / (a * -1.5);
} else if (b <= 1.65e-75) {
tmp = (Math.sqrt((-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 <= -7e-142: tmp = b / (a * -1.5) elif b <= 1.65e-75: tmp = (math.sqrt((-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 <= -7e-142) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 1.65e-75) tmp = Float64(Float64(sqrt(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 <= -7e-142) tmp = b / (a * -1.5); elseif (b <= 1.65e-75) tmp = (sqrt((-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, -7e-142], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.65e-75], N[(N[(N[Sqrt[N[(-3.0 * N[(a * 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 -7 \cdot 10^{-142}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 1.65 \cdot 10^{-75}:\\
\;\;\;\;\frac{\sqrt{-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 < -7.00000000000000029e-142Initial program 76.3%
sqr-neg76.3%
sqr-neg76.3%
associate-*l*76.3%
Simplified76.3%
Taylor expanded in b around -inf 92.0%
*-commutative92.0%
Simplified92.0%
*-commutative92.0%
clear-num91.8%
un-div-inv91.9%
Applied egg-rr91.9%
associate-/r/92.0%
Simplified92.0%
*-commutative92.0%
clear-num91.8%
un-div-inv91.9%
div-inv92.1%
metadata-eval92.1%
Applied egg-rr92.1%
if -7.00000000000000029e-142 < b < 1.65e-75Initial program 76.2%
sqr-neg76.2%
sqr-neg76.2%
associate-*l*76.1%
Simplified76.1%
Taylor expanded in b around 0 74.7%
*-commutative74.7%
associate-*l*74.6%
*-commutative74.6%
*-commutative74.6%
Simplified74.6%
+-commutative74.6%
unsub-neg74.6%
*-commutative74.6%
*-commutative74.6%
associate-*l*74.7%
Applied egg-rr74.7%
if 1.65e-75 < b Initial program 17.5%
sqr-neg17.5%
sqr-neg17.5%
associate-*l*17.4%
Simplified17.4%
Taylor expanded in b around inf 83.4%
*-commutative83.4%
Simplified83.4%
Final simplification84.3%
(FPCore (a b c)
:precision binary64
(if (<= b -7e-142)
(/ b (* a -1.5))
(if (<= b 9e-76)
(* (/ 0.3333333333333333 a) (- (sqrt (* c (* a -3.0))) b))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7e-142) {
tmp = b / (a * -1.5);
} else if (b <= 9e-76) {
tmp = (0.3333333333333333 / a) * (sqrt((c * (a * -3.0))) - b);
} 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 <= (-7d-142)) then
tmp = b / (a * (-1.5d0))
else if (b <= 9d-76) then
tmp = (0.3333333333333333d0 / a) * (sqrt((c * (a * (-3.0d0)))) - b)
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 <= -7e-142) {
tmp = b / (a * -1.5);
} else if (b <= 9e-76) {
tmp = (0.3333333333333333 / a) * (Math.sqrt((c * (a * -3.0))) - b);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -7e-142: tmp = b / (a * -1.5) elif b <= 9e-76: tmp = (0.3333333333333333 / a) * (math.sqrt((c * (a * -3.0))) - b) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -7e-142) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 9e-76) tmp = Float64(Float64(0.3333333333333333 / a) * Float64(sqrt(Float64(c * Float64(a * -3.0))) - b)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -7e-142) tmp = b / (a * -1.5); elseif (b <= 9e-76) tmp = (0.3333333333333333 / a) * (sqrt((c * (a * -3.0))) - b); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -7e-142], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9e-76], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7 \cdot 10^{-142}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 9 \cdot 10^{-76}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(\sqrt{c \cdot \left(a \cdot -3\right)} - b\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -7.00000000000000029e-142Initial program 76.3%
sqr-neg76.3%
sqr-neg76.3%
associate-*l*76.3%
Simplified76.3%
Taylor expanded in b around -inf 92.0%
*-commutative92.0%
Simplified92.0%
*-commutative92.0%
clear-num91.8%
un-div-inv91.9%
Applied egg-rr91.9%
associate-/r/92.0%
Simplified92.0%
*-commutative92.0%
clear-num91.8%
un-div-inv91.9%
div-inv92.1%
metadata-eval92.1%
Applied egg-rr92.1%
if -7.00000000000000029e-142 < b < 9.0000000000000001e-76Initial program 76.2%
sqr-neg76.2%
sqr-neg76.2%
associate-*l*76.1%
Simplified76.1%
Taylor expanded in b around 0 74.7%
*-commutative74.7%
associate-*l*74.6%
*-commutative74.6%
*-commutative74.6%
Simplified74.6%
*-un-lft-identity74.6%
div-inv74.5%
add-sqr-sqrt38.8%
sqrt-unprod74.1%
sqr-neg74.1%
sqrt-unprod35.5%
add-sqr-sqrt73.8%
*-commutative73.8%
*-commutative73.8%
associate-*l*73.8%
*-commutative73.8%
metadata-eval73.8%
div-inv73.7%
clear-num73.9%
Applied egg-rr73.9%
*-lft-identity73.9%
*-commutative73.9%
Simplified73.9%
+-commutative73.9%
add-sqr-sqrt35.5%
sqrt-unprod74.2%
sqr-neg74.2%
sqrt-unprod38.9%
add-sqr-sqrt74.6%
unsub-neg74.6%
*-commutative74.6%
associate-*r*74.6%
*-commutative74.6%
Applied egg-rr74.6%
if 9.0000000000000001e-76 < b Initial program 17.5%
sqr-neg17.5%
sqr-neg17.5%
associate-*l*17.4%
Simplified17.4%
Taylor expanded in b around inf 83.4%
*-commutative83.4%
Simplified83.4%
Final simplification84.3%
(FPCore (a b c)
:precision binary64
(if (<= b -7e-142)
(/ b (* a -1.5))
(if (<= b 2.8e-75)
(* (/ 0.3333333333333333 a) (+ b (sqrt (* -3.0 (* a c)))))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7e-142) {
tmp = b / (a * -1.5);
} else if (b <= 2.8e-75) {
tmp = (0.3333333333333333 / a) * (b + sqrt((-3.0 * (a * c))));
} 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 <= (-7d-142)) then
tmp = b / (a * (-1.5d0))
else if (b <= 2.8d-75) then
tmp = (0.3333333333333333d0 / a) * (b + sqrt(((-3.0d0) * (a * c))))
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 <= -7e-142) {
tmp = b / (a * -1.5);
} else if (b <= 2.8e-75) {
tmp = (0.3333333333333333 / a) * (b + Math.sqrt((-3.0 * (a * c))));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -7e-142: tmp = b / (a * -1.5) elif b <= 2.8e-75: tmp = (0.3333333333333333 / a) * (b + math.sqrt((-3.0 * (a * c)))) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -7e-142) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 2.8e-75) tmp = Float64(Float64(0.3333333333333333 / a) * Float64(b + sqrt(Float64(-3.0 * Float64(a * c))))); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -7e-142) tmp = b / (a * -1.5); elseif (b <= 2.8e-75) tmp = (0.3333333333333333 / a) * (b + sqrt((-3.0 * (a * c)))); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -7e-142], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.8e-75], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(b + N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7 \cdot 10^{-142}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 2.8 \cdot 10^{-75}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(b + \sqrt{-3 \cdot \left(a \cdot c\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -7.00000000000000029e-142Initial program 76.3%
sqr-neg76.3%
sqr-neg76.3%
associate-*l*76.3%
Simplified76.3%
Taylor expanded in b around -inf 92.0%
*-commutative92.0%
Simplified92.0%
*-commutative92.0%
clear-num91.8%
un-div-inv91.9%
Applied egg-rr91.9%
associate-/r/92.0%
Simplified92.0%
*-commutative92.0%
clear-num91.8%
un-div-inv91.9%
div-inv92.1%
metadata-eval92.1%
Applied egg-rr92.1%
if -7.00000000000000029e-142 < b < 2.79999999999999998e-75Initial program 76.2%
sqr-neg76.2%
sqr-neg76.2%
associate-*l*76.1%
Simplified76.1%
Taylor expanded in b around 0 74.7%
*-commutative74.7%
associate-*l*74.6%
*-commutative74.6%
*-commutative74.6%
Simplified74.6%
*-un-lft-identity74.6%
div-inv74.5%
add-sqr-sqrt38.8%
sqrt-unprod74.1%
sqr-neg74.1%
sqrt-unprod35.5%
add-sqr-sqrt73.8%
*-commutative73.8%
*-commutative73.8%
associate-*l*73.8%
*-commutative73.8%
metadata-eval73.8%
div-inv73.7%
clear-num73.9%
Applied egg-rr73.9%
*-lft-identity73.9%
*-commutative73.9%
Simplified73.9%
if 2.79999999999999998e-75 < b Initial program 17.5%
sqr-neg17.5%
sqr-neg17.5%
associate-*l*17.4%
Simplified17.4%
Taylor expanded in b around inf 83.4%
*-commutative83.4%
Simplified83.4%
Final simplification84.1%
(FPCore (a b c)
:precision binary64
(if (<= b -7e-142)
(/ b (* a -1.5))
(if (<= b 7.2e-76)
(* 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 <= -7e-142) {
tmp = b / (a * -1.5);
} else if (b <= 7.2e-76) {
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 <= (-7d-142)) then
tmp = b / (a * (-1.5d0))
else if (b <= 7.2d-76) 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 <= -7e-142) {
tmp = b / (a * -1.5);
} else if (b <= 7.2e-76) {
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 <= -7e-142: tmp = b / (a * -1.5) elif b <= 7.2e-76: 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 <= -7e-142) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 7.2e-76) 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 <= -7e-142) tmp = b / (a * -1.5); elseif (b <= 7.2e-76) 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, -7e-142], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.2e-76], 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 -7 \cdot 10^{-142}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-76}:\\
\;\;\;\;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 < -7.00000000000000029e-142Initial program 76.3%
sqr-neg76.3%
sqr-neg76.3%
associate-*l*76.3%
Simplified76.3%
Taylor expanded in b around -inf 92.0%
*-commutative92.0%
Simplified92.0%
*-commutative92.0%
clear-num91.8%
un-div-inv91.9%
Applied egg-rr91.9%
associate-/r/92.0%
Simplified92.0%
*-commutative92.0%
clear-num91.8%
un-div-inv91.9%
div-inv92.1%
metadata-eval92.1%
Applied egg-rr92.1%
if -7.00000000000000029e-142 < b < 7.2000000000000001e-76Initial program 76.2%
sqr-neg76.2%
sqr-neg76.2%
associate-*l*76.1%
Simplified76.1%
Taylor expanded in b around 0 74.7%
*-commutative74.7%
associate-*l*74.6%
*-commutative74.6%
*-commutative74.6%
Simplified74.6%
*-commutative74.6%
sqrt-prod53.8%
*-commutative53.8%
Applied egg-rr53.8%
*-un-lft-identity53.8%
times-frac53.6%
metadata-eval53.6%
add-sqr-sqrt27.7%
sqrt-unprod53.6%
sqr-neg53.6%
sqrt-unprod25.9%
add-sqr-sqrt53.4%
sqrt-unprod73.8%
associate-*r*73.8%
*-commutative73.8%
associate-*r*73.8%
*-commutative73.8%
Applied egg-rr73.8%
if 7.2000000000000001e-76 < b Initial program 17.5%
sqr-neg17.5%
sqr-neg17.5%
associate-*l*17.4%
Simplified17.4%
Taylor expanded in b around inf 83.4%
*-commutative83.4%
Simplified83.4%
Final simplification84.1%
(FPCore (a b c)
:precision binary64
(if (<= b -7e-142)
(/ b (* a -1.5))
(if (<= b 1.05e-75)
(* 0.3333333333333333 (/ (+ b (sqrt (* -3.0 (* a c)))) a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7e-142) {
tmp = b / (a * -1.5);
} else if (b <= 1.05e-75) {
tmp = 0.3333333333333333 * ((b + sqrt((-3.0 * (a * c)))) / 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 <= (-7d-142)) then
tmp = b / (a * (-1.5d0))
else if (b <= 1.05d-75) then
tmp = 0.3333333333333333d0 * ((b + sqrt(((-3.0d0) * (a * c)))) / 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 <= -7e-142) {
tmp = b / (a * -1.5);
} else if (b <= 1.05e-75) {
tmp = 0.3333333333333333 * ((b + Math.sqrt((-3.0 * (a * c)))) / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -7e-142: tmp = b / (a * -1.5) elif b <= 1.05e-75: tmp = 0.3333333333333333 * ((b + math.sqrt((-3.0 * (a * c)))) / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -7e-142) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 1.05e-75) tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(-3.0 * Float64(a * c)))) / 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 <= -7e-142) tmp = b / (a * -1.5); elseif (b <= 1.05e-75) tmp = 0.3333333333333333 * ((b + sqrt((-3.0 * (a * c)))) / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -7e-142], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.05e-75], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(-3.0 * N[(a * c), $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 -7 \cdot 10^{-142}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 1.05 \cdot 10^{-75}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{-3 \cdot \left(a \cdot c\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -7.00000000000000029e-142Initial program 76.3%
sqr-neg76.3%
sqr-neg76.3%
associate-*l*76.3%
Simplified76.3%
Taylor expanded in b around -inf 92.0%
*-commutative92.0%
Simplified92.0%
*-commutative92.0%
clear-num91.8%
un-div-inv91.9%
Applied egg-rr91.9%
associate-/r/92.0%
Simplified92.0%
*-commutative92.0%
clear-num91.8%
un-div-inv91.9%
div-inv92.1%
metadata-eval92.1%
Applied egg-rr92.1%
if -7.00000000000000029e-142 < b < 1.0500000000000001e-75Initial program 76.2%
sqr-neg76.2%
sqr-neg76.2%
associate-*l*76.1%
Simplified76.1%
Taylor expanded in b around 0 74.7%
*-commutative74.7%
associate-*l*74.6%
*-commutative74.6%
*-commutative74.6%
Simplified74.6%
*-un-lft-identity74.6%
times-frac74.5%
metadata-eval74.5%
add-sqr-sqrt38.8%
sqrt-unprod74.1%
sqr-neg74.1%
sqrt-unprod35.5%
add-sqr-sqrt73.8%
*-commutative73.8%
*-commutative73.8%
associate-*l*73.8%
Applied egg-rr73.8%
if 1.0500000000000001e-75 < b Initial program 17.5%
sqr-neg17.5%
sqr-neg17.5%
associate-*l*17.4%
Simplified17.4%
Taylor expanded in b around inf 83.4%
*-commutative83.4%
Simplified83.4%
Final simplification84.1%
(FPCore (a b c) :precision binary64 (if (<= b 3.5e-280) (/ (* b -0.6666666666666666) a) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.5e-280) {
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 <= 3.5d-280) 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 <= 3.5e-280) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 3.5e-280: tmp = (b * -0.6666666666666666) / a else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 3.5e-280) tmp = Float64(Float64(b * -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 <= 3.5e-280) tmp = (b * -0.6666666666666666) / a; else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 3.5e-280], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.5 \cdot 10^{-280}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 3.5000000000000001e-280Initial program 78.6%
sqr-neg78.6%
sqr-neg78.6%
associate-*l*78.6%
Simplified78.6%
Taylor expanded in b around -inf 70.6%
*-commutative70.6%
Simplified70.6%
associate-*l/70.7%
Applied egg-rr70.7%
if 3.5000000000000001e-280 < b Initial program 29.7%
sqr-neg29.7%
sqr-neg29.7%
associate-*l*29.6%
Simplified29.6%
Taylor expanded in b around inf 70.3%
*-commutative70.3%
Simplified70.3%
(FPCore (a b c) :precision binary64 (if (<= b 3.5e-280) (/ b (* a -1.5)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.5e-280) {
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 <= 3.5d-280) 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 <= 3.5e-280) {
tmp = b / (a * -1.5);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 3.5e-280: tmp = b / (a * -1.5) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 3.5e-280) 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 <= 3.5e-280) tmp = b / (a * -1.5); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 3.5e-280], 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 3.5 \cdot 10^{-280}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 3.5000000000000001e-280Initial program 78.6%
sqr-neg78.6%
sqr-neg78.6%
associate-*l*78.6%
Simplified78.6%
Taylor expanded in b around -inf 70.6%
*-commutative70.6%
Simplified70.6%
*-commutative70.6%
clear-num70.5%
un-div-inv70.6%
Applied egg-rr70.6%
associate-/r/70.7%
Simplified70.7%
*-commutative70.7%
clear-num70.5%
un-div-inv70.6%
div-inv70.7%
metadata-eval70.7%
Applied egg-rr70.7%
if 3.5000000000000001e-280 < b Initial program 29.7%
sqr-neg29.7%
sqr-neg29.7%
associate-*l*29.6%
Simplified29.6%
Taylor expanded in b around inf 70.3%
*-commutative70.3%
Simplified70.3%
(FPCore (a b c) :precision binary64 (if (<= b 3.5e-280) (* b (/ -0.6666666666666666 a)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.5e-280) {
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 <= 3.5d-280) 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 <= 3.5e-280) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 3.5e-280: tmp = b * (-0.6666666666666666 / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 3.5e-280) 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 <= 3.5e-280) tmp = b * (-0.6666666666666666 / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 3.5e-280], 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.5 \cdot 10^{-280}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 3.5000000000000001e-280Initial program 78.6%
sqr-neg78.6%
sqr-neg78.6%
associate-*l*78.6%
Simplified78.6%
Taylor expanded in b around -inf 70.6%
*-commutative70.6%
Simplified70.6%
*-commutative70.6%
clear-num70.5%
un-div-inv70.6%
Applied egg-rr70.6%
associate-/r/70.7%
Simplified70.7%
if 3.5000000000000001e-280 < b Initial program 29.7%
sqr-neg29.7%
sqr-neg29.7%
associate-*l*29.6%
Simplified29.6%
Taylor expanded in b around inf 70.3%
*-commutative70.3%
Simplified70.3%
Final simplification70.5%
(FPCore (a b c) :precision binary64 (if (<= b 1e-279) (* b (/ -0.6666666666666666 a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1e-279) {
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 <= 1d-279) 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 <= 1e-279) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1e-279: tmp = b * (-0.6666666666666666 / a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1e-279) 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 <= 1e-279) tmp = b * (-0.6666666666666666 / a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1e-279], 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 10^{-279}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 1.00000000000000006e-279Initial program 78.6%
sqr-neg78.6%
sqr-neg78.6%
associate-*l*78.6%
Simplified78.6%
Taylor expanded in b around -inf 70.6%
*-commutative70.6%
Simplified70.6%
*-commutative70.6%
clear-num70.5%
un-div-inv70.6%
Applied egg-rr70.6%
associate-/r/70.7%
Simplified70.7%
if 1.00000000000000006e-279 < b Initial program 29.7%
sqr-neg29.7%
sqr-neg29.7%
associate-*l*29.6%
Simplified29.6%
frac-2neg29.6%
div-inv29.6%
Applied egg-rr29.6%
Taylor expanded in b around inf 70.3%
metadata-eval70.3%
times-frac70.3%
*-commutative70.3%
times-frac70.0%
/-rgt-identity70.0%
Simplified70.0%
Final simplification70.4%
(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 53.7%
sqr-neg53.7%
sqr-neg53.7%
associate-*l*53.7%
Simplified53.7%
frac-2neg53.7%
div-inv53.6%
Applied egg-rr53.6%
Taylor expanded in b around inf 36.9%
metadata-eval36.9%
times-frac36.9%
*-commutative36.9%
times-frac36.8%
/-rgt-identity36.8%
Simplified36.8%
herbie shell --seed 2024141
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))