
(FPCore (a b) :precision binary64 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (+ 1.0 a)) (* (* b b) (- 1.0 (* 3.0 a)))))) 1.0))
double code(double a, double b) {
return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (((a * a) * (1.0d0 + a)) + ((b * b) * (1.0d0 - (3.0d0 * a)))))) - 1.0d0
end function
public static double code(double a, double b) {
return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0;
}
def code(a, b): return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0
function code(a, b) return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 + a)) + Float64(Float64(b * b) * Float64(1.0 - Float64(3.0 * a)))))) - 1.0) end
function tmp = code(a, b) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0; end
code[a_, b_] := N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 + a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(3.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b) :precision binary64 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (+ 1.0 a)) (* (* b b) (- 1.0 (* 3.0 a)))))) 1.0))
double code(double a, double b) {
return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (((a * a) * (1.0d0 + a)) + ((b * b) * (1.0d0 - (3.0d0 * a)))))) - 1.0d0
end function
public static double code(double a, double b) {
return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0;
}
def code(a, b): return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0
function code(a, b) return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 + a)) + Float64(Float64(b * b) * Float64(1.0 - Float64(3.0 * a)))))) - 1.0) end
function tmp = code(a, b) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0; end
code[a_, b_] := N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 + a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(3.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1
\end{array}
(FPCore (a b) :precision binary64 (+ (pow (hypot a b) 4.0) (+ (* 4.0 (* b b)) -1.0)))
double code(double a, double b) {
return pow(hypot(a, b), 4.0) + ((4.0 * (b * b)) + -1.0);
}
public static double code(double a, double b) {
return Math.pow(Math.hypot(a, b), 4.0) + ((4.0 * (b * b)) + -1.0);
}
def code(a, b): return math.pow(math.hypot(a, b), 4.0) + ((4.0 * (b * b)) + -1.0)
function code(a, b) return Float64((hypot(a, b) ^ 4.0) + Float64(Float64(4.0 * Float64(b * b)) + -1.0)) end
function tmp = code(a, b) tmp = (hypot(a, b) ^ 4.0) + ((4.0 * (b * b)) + -1.0); end
code[a_, b_] := N[(N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision] + N[(N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \left(4 \cdot \left(b \cdot b\right) + -1\right)
\end{array}
Initial program 73.7%
associate--l+73.7%
fma-def73.7%
Simplified74.9%
fma-def74.9%
add-sqr-sqrt74.9%
hypot-udef74.9%
hypot-udef74.9%
pow-prod-down74.9%
pow-prod-up75.0%
metadata-eval75.0%
expm1-log1p-u73.6%
expm1-udef73.6%
Applied egg-rr73.6%
expm1-def73.6%
expm1-log1p75.0%
Simplified75.0%
Taylor expanded in a around 0 98.5%
unpow298.5%
Simplified98.5%
Final simplification98.5%
(FPCore (a b)
:precision binary64
(let* ((t_0
(+
(pow (+ (* b b) (* a a)) 2.0)
(* 4.0 (+ (* (* a a) (+ a 1.0)) (* (* b b) (- 1.0 (* a 3.0))))))))
(if (<= t_0 INFINITY) (+ t_0 -1.0) (* 2.0 (* b (* b (* a a)))))))
double code(double a, double b) {
double t_0 = pow(((b * b) + (a * a)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0 + -1.0;
} else {
tmp = 2.0 * (b * (b * (a * a)));
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = Math.pow(((b * b) + (a * a)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 + -1.0;
} else {
tmp = 2.0 * (b * (b * (a * a)));
}
return tmp;
}
def code(a, b): t_0 = math.pow(((b * b) + (a * a)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0))))) tmp = 0 if t_0 <= math.inf: tmp = t_0 + -1.0 else: tmp = 2.0 * (b * (b * (a * a))) return tmp
function code(a, b) t_0 = Float64((Float64(Float64(b * b) + Float64(a * a)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(a + 1.0)) + Float64(Float64(b * b) * Float64(1.0 - Float64(a * 3.0)))))) tmp = 0.0 if (t_0 <= Inf) tmp = Float64(t_0 + -1.0); else tmp = Float64(2.0 * Float64(b * Float64(b * Float64(a * a)))); end return tmp end
function tmp_2 = code(a, b) t_0 = (((b * b) + (a * a)) ^ 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0))))); tmp = 0.0; if (t_0 <= Inf) tmp = t_0 + -1.0; else tmp = 2.0 * (b * (b * (a * a))); end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[Power[N[(N[(b * b), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[(t$95$0 + -1.0), $MachinePrecision], N[(2.0 * N[(b * N[(b * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(b \cdot b + a \cdot a\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(a + 1\right) + \left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right)\right)\\
\mathbf{if}\;t_0 \leq \infty:\\
\;\;\;\;t_0 + -1\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(b \cdot \left(b \cdot \left(a \cdot a\right)\right)\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) < +inf.0Initial program 99.8%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) Initial program 0.0%
associate--l+0.0%
fma-def0.0%
Simplified4.5%
Taylor expanded in b around inf 83.7%
*-commutative83.7%
fma-def83.7%
unpow283.7%
+-commutative83.7%
+-commutative83.7%
fma-def83.7%
unpow283.7%
distribute-lft-in83.7%
metadata-eval83.7%
associate-*r*83.7%
metadata-eval83.7%
Simplified83.7%
Taylor expanded in a around inf 50.9%
associate-*r*50.9%
*-commutative50.9%
associate-*r*50.9%
distribute-rgt-out83.7%
*-commutative83.7%
+-commutative83.7%
unpow283.7%
unpow283.7%
associate-*r*83.7%
*-commutative83.7%
distribute-rgt-out83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in a around inf 85.2%
unpow285.2%
*-commutative85.2%
associate-*l*94.2%
unpow294.2%
Simplified94.2%
Final simplification98.4%
(FPCore (a b) :precision binary64 (if (<= a -9.5e+40) (pow a 4.0) (if (<= a 6.5e+40) (+ (+ (* 4.0 (* b b)) -1.0) (pow b 4.0)) (pow a 4.0))))
double code(double a, double b) {
double tmp;
if (a <= -9.5e+40) {
tmp = pow(a, 4.0);
} else if (a <= 6.5e+40) {
tmp = ((4.0 * (b * b)) + -1.0) + pow(b, 4.0);
} else {
tmp = pow(a, 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-9.5d+40)) then
tmp = a ** 4.0d0
else if (a <= 6.5d+40) then
tmp = ((4.0d0 * (b * b)) + (-1.0d0)) + (b ** 4.0d0)
else
tmp = a ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -9.5e+40) {
tmp = Math.pow(a, 4.0);
} else if (a <= 6.5e+40) {
tmp = ((4.0 * (b * b)) + -1.0) + Math.pow(b, 4.0);
} else {
tmp = Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -9.5e+40: tmp = math.pow(a, 4.0) elif a <= 6.5e+40: tmp = ((4.0 * (b * b)) + -1.0) + math.pow(b, 4.0) else: tmp = math.pow(a, 4.0) return tmp
function code(a, b) tmp = 0.0 if (a <= -9.5e+40) tmp = a ^ 4.0; elseif (a <= 6.5e+40) tmp = Float64(Float64(Float64(4.0 * Float64(b * b)) + -1.0) + (b ^ 4.0)); else tmp = a ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -9.5e+40) tmp = a ^ 4.0; elseif (a <= 6.5e+40) tmp = ((4.0 * (b * b)) + -1.0) + (b ^ 4.0); else tmp = a ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -9.5e+40], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 6.5e+40], N[(N[(N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision], N[Power[a, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.5 \cdot 10^{+40}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 6.5 \cdot 10^{+40}:\\
\;\;\;\;\left(4 \cdot \left(b \cdot b\right) + -1\right) + {b}^{4}\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\end{array}
\end{array}
if a < -9.5000000000000003e40 or 6.5000000000000001e40 < a Initial program 39.8%
associate--l+39.8%
fma-def39.8%
Simplified42.5%
Taylor expanded in a around inf 95.3%
if -9.5000000000000003e40 < a < 6.5000000000000001e40Initial program 98.5%
associate--l+98.5%
fma-def98.5%
Simplified98.5%
fma-def98.5%
add-sqr-sqrt98.5%
hypot-udef98.5%
hypot-udef98.5%
pow-prod-down98.5%
pow-prod-up98.6%
metadata-eval98.6%
expm1-log1p-u96.9%
expm1-udef96.9%
Applied egg-rr96.9%
expm1-def96.9%
expm1-log1p98.6%
Simplified98.6%
Taylor expanded in a around 0 97.4%
unpow297.4%
Simplified97.4%
Taylor expanded in a around 0 95.8%
Final simplification95.6%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e+46) (+ (pow a 4.0) (+ (* 4.0 (* a a)) -1.0)) (pow b 4.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+46) {
tmp = pow(a, 4.0) + ((4.0 * (a * a)) + -1.0);
} else {
tmp = pow(b, 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b * b) <= 2d+46) then
tmp = (a ** 4.0d0) + ((4.0d0 * (a * a)) + (-1.0d0))
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+46) {
tmp = Math.pow(a, 4.0) + ((4.0 * (a * a)) + -1.0);
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e+46: tmp = math.pow(a, 4.0) + ((4.0 * (a * a)) + -1.0) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e+46) tmp = Float64((a ^ 4.0) + Float64(Float64(4.0 * Float64(a * a)) + -1.0)); else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e+46) tmp = (a ^ 4.0) + ((4.0 * (a * a)) + -1.0); else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e+46], N[(N[Power[a, 4.0], $MachinePrecision] + N[(N[(4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{+46}:\\
\;\;\;\;{a}^{4} + \left(4 \cdot \left(a \cdot a\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if (*.f64 b b) < 2e46Initial program 81.4%
associate--l+81.4%
fma-def81.4%
Simplified81.4%
Taylor expanded in b around 0 78.8%
associate--l+78.8%
associate-*r*78.8%
unpow278.8%
Simplified78.8%
Taylor expanded in a around 0 95.2%
unpow295.2%
Simplified95.2%
if 2e46 < (*.f64 b b) Initial program 65.8%
associate--l+65.8%
fma-def65.8%
Simplified68.1%
Taylor expanded in b around inf 92.5%
Final simplification93.9%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e+46) (fma (* a a) (+ 4.0 (* a a)) -1.0) (pow b 4.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+46) {
tmp = fma((a * a), (4.0 + (a * a)), -1.0);
} else {
tmp = pow(b, 4.0);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e+46) tmp = fma(Float64(a * a), Float64(4.0 + Float64(a * a)), -1.0); else tmp = b ^ 4.0; end return tmp end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e+46], N[(N[(a * a), $MachinePrecision] * N[(4.0 + N[(a * a), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{+46}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot a, 4 + a \cdot a, -1\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if (*.f64 b b) < 2e46Initial program 81.4%
associate--l+81.4%
fma-def81.4%
Simplified81.4%
Taylor expanded in b around 0 78.8%
associate--l+78.8%
associate-*r*78.8%
unpow278.8%
Simplified78.8%
Taylor expanded in a around 0 95.2%
unpow295.2%
Simplified95.2%
Taylor expanded in a around 0 95.2%
+-commutative95.2%
metadata-eval95.2%
pow-sqr95.2%
unpow295.2%
unpow295.2%
unpow295.2%
distribute-rgt-out95.2%
fma-neg95.2%
metadata-eval95.2%
Simplified95.2%
if 2e46 < (*.f64 b b) Initial program 65.8%
associate--l+65.8%
fma-def65.8%
Simplified68.1%
Taylor expanded in b around inf 92.5%
Final simplification93.8%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e-13) (* (+ 1.0 (* a 2.0)) (+ (* a 2.0) -1.0)) (if (<= (* b b) 1e+131) (pow a 4.0) (* (* b b) (* a (+ (* a 2.0) -12.0))))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e-13) {
tmp = (1.0 + (a * 2.0)) * ((a * 2.0) + -1.0);
} else if ((b * b) <= 1e+131) {
tmp = pow(a, 4.0);
} else {
tmp = (b * b) * (a * ((a * 2.0) + -12.0));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b * b) <= 2d-13) then
tmp = (1.0d0 + (a * 2.0d0)) * ((a * 2.0d0) + (-1.0d0))
else if ((b * b) <= 1d+131) then
tmp = a ** 4.0d0
else
tmp = (b * b) * (a * ((a * 2.0d0) + (-12.0d0)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e-13) {
tmp = (1.0 + (a * 2.0)) * ((a * 2.0) + -1.0);
} else if ((b * b) <= 1e+131) {
tmp = Math.pow(a, 4.0);
} else {
tmp = (b * b) * (a * ((a * 2.0) + -12.0));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e-13: tmp = (1.0 + (a * 2.0)) * ((a * 2.0) + -1.0) elif (b * b) <= 1e+131: tmp = math.pow(a, 4.0) else: tmp = (b * b) * (a * ((a * 2.0) + -12.0)) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e-13) tmp = Float64(Float64(1.0 + Float64(a * 2.0)) * Float64(Float64(a * 2.0) + -1.0)); elseif (Float64(b * b) <= 1e+131) tmp = a ^ 4.0; else tmp = Float64(Float64(b * b) * Float64(a * Float64(Float64(a * 2.0) + -12.0))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e-13) tmp = (1.0 + (a * 2.0)) * ((a * 2.0) + -1.0); elseif ((b * b) <= 1e+131) tmp = a ^ 4.0; else tmp = (b * b) * (a * ((a * 2.0) + -12.0)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e-13], N[(N[(1.0 + N[(a * 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(a * 2.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(b * b), $MachinePrecision], 1e+131], N[Power[a, 4.0], $MachinePrecision], N[(N[(b * b), $MachinePrecision] * N[(a * N[(N[(a * 2.0), $MachinePrecision] + -12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{-13}:\\
\;\;\;\;\left(1 + a \cdot 2\right) \cdot \left(a \cdot 2 + -1\right)\\
\mathbf{elif}\;b \cdot b \leq 10^{+131}:\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(a \cdot \left(a \cdot 2 + -12\right)\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 2.0000000000000001e-13Initial program 84.5%
associate--l+84.5%
fma-def84.5%
Simplified84.5%
Taylor expanded in b around 0 84.4%
associate--l+84.4%
associate-*r*84.4%
unpow284.4%
Simplified84.4%
Taylor expanded in a around 0 78.6%
fma-neg78.6%
unpow278.6%
metadata-eval78.6%
Simplified78.6%
fma-udef78.6%
add-sqr-sqrt78.6%
difference-of-sqr--178.6%
sqrt-prod78.6%
metadata-eval78.6%
sqrt-prod35.9%
add-sqr-sqrt64.8%
*-commutative64.8%
sqrt-prod64.8%
metadata-eval64.8%
sqrt-prod35.9%
add-sqr-sqrt78.6%
*-commutative78.6%
Applied egg-rr78.6%
if 2.0000000000000001e-13 < (*.f64 b b) < 9.9999999999999991e130Initial program 73.3%
associate--l+73.3%
fma-def73.3%
Simplified73.3%
Taylor expanded in a around inf 46.9%
if 9.9999999999999991e130 < (*.f64 b b) Initial program 61.4%
associate--l+61.4%
fma-def61.4%
Simplified64.3%
Taylor expanded in b around inf 99.0%
*-commutative99.0%
fma-def99.0%
unpow299.0%
+-commutative99.0%
+-commutative99.0%
fma-def99.0%
unpow299.0%
distribute-lft-in99.0%
metadata-eval99.0%
associate-*r*99.0%
metadata-eval99.0%
Simplified99.0%
Taylor expanded in a around inf 39.1%
associate-*r*39.1%
*-commutative39.1%
associate-*r*39.1%
distribute-rgt-out67.8%
*-commutative67.8%
+-commutative67.8%
unpow267.8%
unpow267.8%
associate-*r*67.8%
*-commutative67.8%
distribute-rgt-out67.8%
*-commutative67.8%
Simplified67.8%
Final simplification69.6%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e+46) (* (+ 1.0 (* a 2.0)) (+ (* a 2.0) -1.0)) (pow b 4.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+46) {
tmp = (1.0 + (a * 2.0)) * ((a * 2.0) + -1.0);
} else {
tmp = pow(b, 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b * b) <= 2d+46) then
tmp = (1.0d0 + (a * 2.0d0)) * ((a * 2.0d0) + (-1.0d0))
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+46) {
tmp = (1.0 + (a * 2.0)) * ((a * 2.0) + -1.0);
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e+46: tmp = (1.0 + (a * 2.0)) * ((a * 2.0) + -1.0) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e+46) tmp = Float64(Float64(1.0 + Float64(a * 2.0)) * Float64(Float64(a * 2.0) + -1.0)); else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e+46) tmp = (1.0 + (a * 2.0)) * ((a * 2.0) + -1.0); else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e+46], N[(N[(1.0 + N[(a * 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(a * 2.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{+46}:\\
\;\;\;\;\left(1 + a \cdot 2\right) \cdot \left(a \cdot 2 + -1\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if (*.f64 b b) < 2e46Initial program 81.4%
associate--l+81.4%
fma-def81.4%
Simplified81.4%
Taylor expanded in b around 0 78.8%
associate--l+78.8%
associate-*r*78.8%
unpow278.8%
Simplified78.8%
Taylor expanded in a around 0 76.3%
fma-neg76.3%
unpow276.3%
metadata-eval76.3%
Simplified76.3%
fma-udef76.3%
add-sqr-sqrt76.3%
difference-of-sqr--176.3%
sqrt-prod76.3%
metadata-eval76.3%
sqrt-prod34.0%
add-sqr-sqrt60.0%
*-commutative60.0%
sqrt-prod60.0%
metadata-eval60.0%
sqrt-prod34.0%
add-sqr-sqrt76.3%
*-commutative76.3%
Applied egg-rr76.3%
if 2e46 < (*.f64 b b) Initial program 65.8%
associate--l+65.8%
fma-def65.8%
Simplified68.1%
Taylor expanded in b around inf 92.5%
Final simplification84.3%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e-13) (+ (* a (* a 4.0)) -1.0) (* (* b b) (* a (+ (* a 2.0) -12.0)))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e-13) {
tmp = (a * (a * 4.0)) + -1.0;
} else {
tmp = (b * b) * (a * ((a * 2.0) + -12.0));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b * b) <= 2d-13) then
tmp = (a * (a * 4.0d0)) + (-1.0d0)
else
tmp = (b * b) * (a * ((a * 2.0d0) + (-12.0d0)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e-13) {
tmp = (a * (a * 4.0)) + -1.0;
} else {
tmp = (b * b) * (a * ((a * 2.0) + -12.0));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e-13: tmp = (a * (a * 4.0)) + -1.0 else: tmp = (b * b) * (a * ((a * 2.0) + -12.0)) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e-13) tmp = Float64(Float64(a * Float64(a * 4.0)) + -1.0); else tmp = Float64(Float64(b * b) * Float64(a * Float64(Float64(a * 2.0) + -12.0))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e-13) tmp = (a * (a * 4.0)) + -1.0; else tmp = (b * b) * (a * ((a * 2.0) + -12.0)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e-13], N[(N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(b * b), $MachinePrecision] * N[(a * N[(N[(a * 2.0), $MachinePrecision] + -12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{-13}:\\
\;\;\;\;a \cdot \left(a \cdot 4\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(a \cdot \left(a \cdot 2 + -12\right)\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 2.0000000000000001e-13Initial program 84.5%
associate--l+84.5%
fma-def84.5%
Simplified84.5%
Taylor expanded in b around 0 84.4%
associate--l+84.4%
associate-*r*84.4%
unpow284.4%
Simplified84.4%
Taylor expanded in a around 0 78.6%
fma-neg78.6%
unpow278.6%
metadata-eval78.6%
Simplified78.6%
metadata-eval78.6%
fma-neg78.6%
associate-*r*78.6%
*-commutative78.6%
Applied egg-rr78.6%
if 2.0000000000000001e-13 < (*.f64 b b) Initial program 64.6%
associate--l+64.6%
fma-def64.6%
Simplified66.8%
Taylor expanded in b around inf 95.4%
*-commutative95.4%
fma-def95.4%
unpow295.4%
+-commutative95.4%
+-commutative95.4%
fma-def95.4%
unpow295.4%
distribute-lft-in95.4%
metadata-eval95.4%
associate-*r*95.4%
metadata-eval95.4%
Simplified95.4%
Taylor expanded in a around inf 38.0%
associate-*r*38.0%
*-commutative38.0%
associate-*r*38.0%
distribute-rgt-out58.8%
*-commutative58.8%
+-commutative58.8%
unpow258.8%
unpow258.8%
associate-*r*58.8%
*-commutative58.8%
distribute-rgt-out58.8%
*-commutative58.8%
Simplified58.8%
Final simplification67.9%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e-13) (* (+ 1.0 (* a 2.0)) (+ (* a 2.0) -1.0)) (* (* b b) (* a (+ (* a 2.0) -12.0)))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e-13) {
tmp = (1.0 + (a * 2.0)) * ((a * 2.0) + -1.0);
} else {
tmp = (b * b) * (a * ((a * 2.0) + -12.0));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b * b) <= 2d-13) then
tmp = (1.0d0 + (a * 2.0d0)) * ((a * 2.0d0) + (-1.0d0))
else
tmp = (b * b) * (a * ((a * 2.0d0) + (-12.0d0)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e-13) {
tmp = (1.0 + (a * 2.0)) * ((a * 2.0) + -1.0);
} else {
tmp = (b * b) * (a * ((a * 2.0) + -12.0));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e-13: tmp = (1.0 + (a * 2.0)) * ((a * 2.0) + -1.0) else: tmp = (b * b) * (a * ((a * 2.0) + -12.0)) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e-13) tmp = Float64(Float64(1.0 + Float64(a * 2.0)) * Float64(Float64(a * 2.0) + -1.0)); else tmp = Float64(Float64(b * b) * Float64(a * Float64(Float64(a * 2.0) + -12.0))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e-13) tmp = (1.0 + (a * 2.0)) * ((a * 2.0) + -1.0); else tmp = (b * b) * (a * ((a * 2.0) + -12.0)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e-13], N[(N[(1.0 + N[(a * 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(a * 2.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(b * b), $MachinePrecision] * N[(a * N[(N[(a * 2.0), $MachinePrecision] + -12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{-13}:\\
\;\;\;\;\left(1 + a \cdot 2\right) \cdot \left(a \cdot 2 + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(a \cdot \left(a \cdot 2 + -12\right)\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 2.0000000000000001e-13Initial program 84.5%
associate--l+84.5%
fma-def84.5%
Simplified84.5%
Taylor expanded in b around 0 84.4%
associate--l+84.4%
associate-*r*84.4%
unpow284.4%
Simplified84.4%
Taylor expanded in a around 0 78.6%
fma-neg78.6%
unpow278.6%
metadata-eval78.6%
Simplified78.6%
fma-udef78.6%
add-sqr-sqrt78.6%
difference-of-sqr--178.6%
sqrt-prod78.6%
metadata-eval78.6%
sqrt-prod35.9%
add-sqr-sqrt64.8%
*-commutative64.8%
sqrt-prod64.8%
metadata-eval64.8%
sqrt-prod35.9%
add-sqr-sqrt78.6%
*-commutative78.6%
Applied egg-rr78.6%
if 2.0000000000000001e-13 < (*.f64 b b) Initial program 64.6%
associate--l+64.6%
fma-def64.6%
Simplified66.8%
Taylor expanded in b around inf 95.4%
*-commutative95.4%
fma-def95.4%
unpow295.4%
+-commutative95.4%
+-commutative95.4%
fma-def95.4%
unpow295.4%
distribute-lft-in95.4%
metadata-eval95.4%
associate-*r*95.4%
metadata-eval95.4%
Simplified95.4%
Taylor expanded in a around inf 38.0%
associate-*r*38.0%
*-commutative38.0%
associate-*r*38.0%
distribute-rgt-out58.8%
*-commutative58.8%
+-commutative58.8%
unpow258.8%
unpow258.8%
associate-*r*58.8%
*-commutative58.8%
distribute-rgt-out58.8%
*-commutative58.8%
Simplified58.8%
Final simplification67.9%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e-13) (+ (* a (* a 4.0)) -1.0) (* 2.0 (* b (* b (* a a))))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e-13) {
tmp = (a * (a * 4.0)) + -1.0;
} else {
tmp = 2.0 * (b * (b * (a * a)));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b * b) <= 2d-13) then
tmp = (a * (a * 4.0d0)) + (-1.0d0)
else
tmp = 2.0d0 * (b * (b * (a * a)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e-13) {
tmp = (a * (a * 4.0)) + -1.0;
} else {
tmp = 2.0 * (b * (b * (a * a)));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e-13: tmp = (a * (a * 4.0)) + -1.0 else: tmp = 2.0 * (b * (b * (a * a))) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e-13) tmp = Float64(Float64(a * Float64(a * 4.0)) + -1.0); else tmp = Float64(2.0 * Float64(b * Float64(b * Float64(a * a)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e-13) tmp = (a * (a * 4.0)) + -1.0; else tmp = 2.0 * (b * (b * (a * a))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e-13], N[(N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(2.0 * N[(b * N[(b * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{-13}:\\
\;\;\;\;a \cdot \left(a \cdot 4\right) + -1\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(b \cdot \left(b \cdot \left(a \cdot a\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 2.0000000000000001e-13Initial program 84.5%
associate--l+84.5%
fma-def84.5%
Simplified84.5%
Taylor expanded in b around 0 84.4%
associate--l+84.4%
associate-*r*84.4%
unpow284.4%
Simplified84.4%
Taylor expanded in a around 0 78.6%
fma-neg78.6%
unpow278.6%
metadata-eval78.6%
Simplified78.6%
metadata-eval78.6%
fma-neg78.6%
associate-*r*78.6%
*-commutative78.6%
Applied egg-rr78.6%
if 2.0000000000000001e-13 < (*.f64 b b) Initial program 64.6%
associate--l+64.6%
fma-def64.6%
Simplified66.8%
Taylor expanded in b around inf 95.4%
*-commutative95.4%
fma-def95.4%
unpow295.4%
+-commutative95.4%
+-commutative95.4%
fma-def95.4%
unpow295.4%
distribute-lft-in95.4%
metadata-eval95.4%
associate-*r*95.4%
metadata-eval95.4%
Simplified95.4%
Taylor expanded in a around inf 38.0%
associate-*r*38.0%
*-commutative38.0%
associate-*r*38.0%
distribute-rgt-out58.8%
*-commutative58.8%
+-commutative58.8%
unpow258.8%
unpow258.8%
associate-*r*58.8%
*-commutative58.8%
distribute-rgt-out58.8%
*-commutative58.8%
Simplified58.8%
Taylor expanded in a around inf 58.3%
unpow258.3%
*-commutative58.3%
associate-*l*51.6%
unpow251.6%
Simplified51.6%
Final simplification64.0%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e-13) (+ (* a (* a 4.0)) -1.0) (* (* b b) (* (* a a) 2.0))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e-13) {
tmp = (a * (a * 4.0)) + -1.0;
} else {
tmp = (b * b) * ((a * a) * 2.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b * b) <= 2d-13) then
tmp = (a * (a * 4.0d0)) + (-1.0d0)
else
tmp = (b * b) * ((a * a) * 2.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e-13) {
tmp = (a * (a * 4.0)) + -1.0;
} else {
tmp = (b * b) * ((a * a) * 2.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e-13: tmp = (a * (a * 4.0)) + -1.0 else: tmp = (b * b) * ((a * a) * 2.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e-13) tmp = Float64(Float64(a * Float64(a * 4.0)) + -1.0); else tmp = Float64(Float64(b * b) * Float64(Float64(a * a) * 2.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e-13) tmp = (a * (a * 4.0)) + -1.0; else tmp = (b * b) * ((a * a) * 2.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e-13], N[(N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(b * b), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{-13}:\\
\;\;\;\;a \cdot \left(a \cdot 4\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(\left(a \cdot a\right) \cdot 2\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 2.0000000000000001e-13Initial program 84.5%
associate--l+84.5%
fma-def84.5%
Simplified84.5%
Taylor expanded in b around 0 84.4%
associate--l+84.4%
associate-*r*84.4%
unpow284.4%
Simplified84.4%
Taylor expanded in a around 0 78.6%
fma-neg78.6%
unpow278.6%
metadata-eval78.6%
Simplified78.6%
metadata-eval78.6%
fma-neg78.6%
associate-*r*78.6%
*-commutative78.6%
Applied egg-rr78.6%
if 2.0000000000000001e-13 < (*.f64 b b) Initial program 64.6%
associate--l+64.6%
fma-def64.6%
Simplified66.8%
Taylor expanded in b around inf 95.4%
*-commutative95.4%
fma-def95.4%
unpow295.4%
+-commutative95.4%
+-commutative95.4%
fma-def95.4%
unpow295.4%
distribute-lft-in95.4%
metadata-eval95.4%
associate-*r*95.4%
metadata-eval95.4%
Simplified95.4%
Taylor expanded in a around inf 58.3%
associate-*r*58.3%
unpow258.3%
unpow258.3%
Simplified58.3%
Final simplification67.5%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* 4.0 (* a a))))
(if (<= a -1.4e+141)
t_0
(if (<= a -0.00136) (* -12.0 (* a (* b b))) (if (<= a 0.42) -1.0 t_0)))))
double code(double a, double b) {
double t_0 = 4.0 * (a * a);
double tmp;
if (a <= -1.4e+141) {
tmp = t_0;
} else if (a <= -0.00136) {
tmp = -12.0 * (a * (b * b));
} else if (a <= 0.42) {
tmp = -1.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: tmp
t_0 = 4.0d0 * (a * a)
if (a <= (-1.4d+141)) then
tmp = t_0
else if (a <= (-0.00136d0)) then
tmp = (-12.0d0) * (a * (b * b))
else if (a <= 0.42d0) then
tmp = -1.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = 4.0 * (a * a);
double tmp;
if (a <= -1.4e+141) {
tmp = t_0;
} else if (a <= -0.00136) {
tmp = -12.0 * (a * (b * b));
} else if (a <= 0.42) {
tmp = -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b): t_0 = 4.0 * (a * a) tmp = 0 if a <= -1.4e+141: tmp = t_0 elif a <= -0.00136: tmp = -12.0 * (a * (b * b)) elif a <= 0.42: tmp = -1.0 else: tmp = t_0 return tmp
function code(a, b) t_0 = Float64(4.0 * Float64(a * a)) tmp = 0.0 if (a <= -1.4e+141) tmp = t_0; elseif (a <= -0.00136) tmp = Float64(-12.0 * Float64(a * Float64(b * b))); elseif (a <= 0.42) tmp = -1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(a, b) t_0 = 4.0 * (a * a); tmp = 0.0; if (a <= -1.4e+141) tmp = t_0; elseif (a <= -0.00136) tmp = -12.0 * (a * (b * b)); elseif (a <= 0.42) tmp = -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.4e+141], t$95$0, If[LessEqual[a, -0.00136], N[(-12.0 * N[(a * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 0.42], -1.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 4 \cdot \left(a \cdot a\right)\\
\mathbf{if}\;a \leq -1.4 \cdot 10^{+141}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;a \leq -0.00136:\\
\;\;\;\;-12 \cdot \left(a \cdot \left(b \cdot b\right)\right)\\
\mathbf{elif}\;a \leq 0.42:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if a < -1.39999999999999996e141 or 0.419999999999999984 < a Initial program 37.5%
associate--l+37.5%
fma-def37.5%
Simplified37.5%
Taylor expanded in b around 0 54.4%
associate--l+54.4%
associate-*r*54.4%
unpow254.4%
Simplified54.4%
Taylor expanded in a around 0 63.9%
fma-neg63.9%
unpow263.9%
metadata-eval63.9%
Simplified63.9%
Taylor expanded in a around inf 64.1%
unpow264.1%
Simplified64.1%
if -1.39999999999999996e141 < a < -0.00136Initial program 72.5%
associate--l+72.5%
fma-def72.5%
Simplified81.6%
Taylor expanded in b around inf 64.8%
*-commutative64.8%
fma-def64.8%
unpow264.8%
+-commutative64.8%
+-commutative64.8%
fma-def64.8%
unpow264.8%
distribute-lft-in64.8%
metadata-eval64.8%
associate-*r*64.8%
metadata-eval64.8%
Simplified64.8%
Taylor expanded in a around inf 53.5%
associate-*r*53.5%
*-commutative53.5%
associate-*r*53.5%
distribute-rgt-out53.5%
*-commutative53.5%
+-commutative53.5%
unpow253.5%
unpow253.5%
associate-*r*53.5%
*-commutative53.5%
distribute-rgt-out53.5%
*-commutative53.5%
Simplified53.5%
Taylor expanded in a around 0 39.2%
unpow239.2%
Simplified39.2%
if -0.00136 < a < 0.419999999999999984Initial program 99.9%
associate--l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in b around 0 51.0%
associate--l+51.0%
associate-*r*51.0%
unpow251.0%
Simplified51.0%
Taylor expanded in a around 0 50.0%
Final simplification53.7%
(FPCore (a b) :precision binary64 (if (or (<= a -0.005) (not (<= a 0.42))) (* 4.0 (* a a)) -1.0))
double code(double a, double b) {
double tmp;
if ((a <= -0.005) || !(a <= 0.42)) {
tmp = 4.0 * (a * a);
} else {
tmp = -1.0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-0.005d0)) .or. (.not. (a <= 0.42d0))) then
tmp = 4.0d0 * (a * a)
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -0.005) || !(a <= 0.42)) {
tmp = 4.0 * (a * a);
} else {
tmp = -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -0.005) or not (a <= 0.42): tmp = 4.0 * (a * a) else: tmp = -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -0.005) || !(a <= 0.42)) tmp = Float64(4.0 * Float64(a * a)); else tmp = -1.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -0.005) || ~((a <= 0.42))) tmp = 4.0 * (a * a); else tmp = -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -0.005], N[Not[LessEqual[a, 0.42]], $MachinePrecision]], N[(4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision], -1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.005 \lor \neg \left(a \leq 0.42\right):\\
\;\;\;\;4 \cdot \left(a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if a < -0.0050000000000000001 or 0.419999999999999984 < a Initial program 46.7%
associate--l+46.7%
fma-def46.7%
Simplified49.1%
Taylor expanded in b around 0 50.8%
associate--l+50.8%
associate-*r*50.8%
unpow250.8%
Simplified50.8%
Taylor expanded in a around 0 48.5%
fma-neg48.5%
unpow248.5%
metadata-eval48.5%
Simplified48.5%
Taylor expanded in a around inf 48.7%
unpow248.7%
Simplified48.7%
if -0.0050000000000000001 < a < 0.419999999999999984Initial program 99.9%
associate--l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in b around 0 51.0%
associate--l+51.0%
associate-*r*51.0%
unpow251.0%
Simplified51.0%
Taylor expanded in a around 0 50.0%
Final simplification49.4%
(FPCore (a b) :precision binary64 (if (<= b 9.5e+162) (+ (* a (* a 4.0)) -1.0) (* -12.0 (* a (* b b)))))
double code(double a, double b) {
double tmp;
if (b <= 9.5e+162) {
tmp = (a * (a * 4.0)) + -1.0;
} else {
tmp = -12.0 * (a * (b * b));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= 9.5d+162) then
tmp = (a * (a * 4.0d0)) + (-1.0d0)
else
tmp = (-12.0d0) * (a * (b * b))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 9.5e+162) {
tmp = (a * (a * 4.0)) + -1.0;
} else {
tmp = -12.0 * (a * (b * b));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 9.5e+162: tmp = (a * (a * 4.0)) + -1.0 else: tmp = -12.0 * (a * (b * b)) return tmp
function code(a, b) tmp = 0.0 if (b <= 9.5e+162) tmp = Float64(Float64(a * Float64(a * 4.0)) + -1.0); else tmp = Float64(-12.0 * Float64(a * Float64(b * b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 9.5e+162) tmp = (a * (a * 4.0)) + -1.0; else tmp = -12.0 * (a * (b * b)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 9.5e+162], N[(N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(-12.0 * N[(a * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 9.5 \cdot 10^{+162}:\\
\;\;\;\;a \cdot \left(a \cdot 4\right) + -1\\
\mathbf{else}:\\
\;\;\;\;-12 \cdot \left(a \cdot \left(b \cdot b\right)\right)\\
\end{array}
\end{array}
if b < 9.50000000000000021e162Initial program 76.3%
associate--l+76.3%
fma-def76.3%
Simplified77.2%
Taylor expanded in b around 0 53.4%
associate--l+53.4%
associate-*r*53.4%
unpow253.4%
Simplified53.4%
Taylor expanded in a around 0 50.9%
fma-neg50.9%
unpow250.9%
metadata-eval50.9%
Simplified50.9%
metadata-eval50.9%
fma-neg50.9%
associate-*r*50.9%
*-commutative50.9%
Applied egg-rr50.9%
if 9.50000000000000021e162 < b Initial program 54.8%
associate--l+54.8%
fma-def54.8%
Simplified58.1%
Taylor expanded in b around inf 100.0%
*-commutative100.0%
fma-def100.0%
unpow2100.0%
+-commutative100.0%
+-commutative100.0%
fma-def100.0%
unpow2100.0%
distribute-lft-in100.0%
metadata-eval100.0%
associate-*r*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around inf 48.4%
associate-*r*48.4%
*-commutative48.4%
associate-*r*48.4%
distribute-rgt-out83.9%
*-commutative83.9%
+-commutative83.9%
unpow283.9%
unpow283.9%
associate-*r*83.9%
*-commutative83.9%
distribute-rgt-out83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in a around 0 58.1%
unpow258.1%
Simplified58.1%
Final simplification51.7%
(FPCore (a b) :precision binary64 -1.0)
double code(double a, double b) {
return -1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = -1.0d0
end function
public static double code(double a, double b) {
return -1.0;
}
def code(a, b): return -1.0
function code(a, b) return -1.0 end
function tmp = code(a, b) tmp = -1.0; end
code[a_, b_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 73.7%
associate--l+73.7%
fma-def73.7%
Simplified74.9%
Taylor expanded in b around 0 50.9%
associate--l+50.9%
associate-*r*50.9%
unpow250.9%
Simplified50.9%
Taylor expanded in a around 0 25.8%
Final simplification25.8%
herbie shell --seed 2023257
(FPCore (a b)
:name "Bouland and Aaronson, Equation (25)"
:precision binary64
(- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (+ 1.0 a)) (* (* b b) (- 1.0 (* 3.0 a)))))) 1.0))