
(FPCore (a b) :precision binary64 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ 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) * (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) * (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) * (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) * (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(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) * (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[(3.0 + a), $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(3 + a\right)\right)\right) - 1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 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) (+ 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) * (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) * (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) * (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) * (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(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) * (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[(3.0 + a), $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(3 + a\right)\right)\right) - 1
\end{array}
(FPCore (a b)
:precision binary64
(let* ((t_0
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ a 3.0)))))))
(if (<= t_0 INFINITY)
(+ t_0 -1.0)
(+
(fma (pow a 2.0) (+ (* 2.0 (pow b 2.0)) (* a (- a 4.0))) (pow b 4.0))
-1.0))))
double code(double a, double b) {
double t_0 = pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0 + -1.0;
} else {
tmp = fma(pow(a, 2.0), ((2.0 * pow(b, 2.0)) + (a * (a - 4.0))), pow(b, 4.0)) + -1.0;
}
return tmp;
}
function code(a, b) t_0 = 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(a + 3.0))))) tmp = 0.0 if (t_0 <= Inf) tmp = Float64(t_0 + -1.0); else tmp = Float64(fma((a ^ 2.0), Float64(Float64(2.0 * (b ^ 2.0)) + Float64(a * Float64(a - 4.0))), (b ^ 4.0)) + -1.0); end return tmp end
code[a_, b_] := Block[{t$95$0 = 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[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[(t$95$0 + -1.0), $MachinePrecision], N[(N[(N[Power[a, 2.0], $MachinePrecision] * N[(N[(2.0 * N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] + N[(a * N[(a - 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\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(a + 3\right)\right)\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0 + -1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left({a}^{2}, 2 \cdot {b}^{2} + a \cdot \left(a - 4\right), {b}^{4}\right) + -1\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) < +inf.0Initial program 99.9%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) Initial program 0.0%
associate--l+0.0%
fma-define0.0%
sqr-neg0.0%
fma-define0.0%
distribute-rgt-in0.0%
sqr-neg0.0%
distribute-rgt-in0.0%
fma-define0.0%
sqr-neg0.0%
Simplified6.6%
fma-define6.6%
unpow26.6%
+-commutative6.6%
distribute-lft-in6.6%
fma-define6.6%
add-sqr-sqrt6.6%
pow26.6%
fma-define6.6%
hypot-define6.6%
pow26.6%
fma-define6.6%
add-sqr-sqrt6.6%
pow26.6%
fma-define6.6%
hypot-define6.6%
pow26.6%
Applied egg-rr6.6%
distribute-lft-out6.6%
Simplified6.6%
Taylor expanded in a around inf 39.3%
mul-1-neg39.3%
Simplified39.3%
Taylor expanded in a around 0 100.0%
sub-neg100.0%
fma-define100.0%
fma-define100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in b around 0 100.0%
Final simplification99.9%
(FPCore (a b)
:precision binary64
(let* ((t_0
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ a 3.0)))))))
(if (<= t_0 INFINITY) (+ t_0 -1.0) (pow a 4.0))))
double code(double a, double b) {
double t_0 = pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0 + -1.0;
} else {
tmp = pow(a, 4.0);
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 + -1.0;
} else {
tmp = Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): t_0 = math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0)))) tmp = 0 if t_0 <= math.inf: tmp = t_0 + -1.0 else: tmp = math.pow(a, 4.0) return tmp
function code(a, b) t_0 = 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(a + 3.0))))) tmp = 0.0 if (t_0 <= Inf) tmp = Float64(t_0 + -1.0); else tmp = a ^ 4.0; end return tmp end
function tmp_2 = code(a, b) t_0 = (((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0)))); tmp = 0.0; if (t_0 <= Inf) tmp = t_0 + -1.0; else tmp = a ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = 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[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[(t$95$0 + -1.0), $MachinePrecision], N[Power[a, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\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(a + 3\right)\right)\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0 + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) < +inf.0Initial program 99.9%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) Initial program 0.0%
associate--l+0.0%
fma-define0.0%
sqr-neg0.0%
fma-define0.0%
distribute-rgt-in0.0%
sqr-neg0.0%
distribute-rgt-in0.0%
fma-define0.0%
sqr-neg0.0%
Simplified6.6%
Taylor expanded in a around inf 95.3%
Final simplification98.8%
(FPCore (a b)
:precision binary64
(if (<= b 1e-209)
-1.0
(if (<= b 1.35e-176)
(pow a 4.0)
(if (<= b 3.4e-115)
-1.0
(if (<= b 4.4e-71)
(pow a 4.0)
(if (<= b 3.8e-52)
-1.0
(if (<= b 8.5e+45) (pow a 4.0) (pow b 4.0))))))))
double code(double a, double b) {
double tmp;
if (b <= 1e-209) {
tmp = -1.0;
} else if (b <= 1.35e-176) {
tmp = pow(a, 4.0);
} else if (b <= 3.4e-115) {
tmp = -1.0;
} else if (b <= 4.4e-71) {
tmp = pow(a, 4.0);
} else if (b <= 3.8e-52) {
tmp = -1.0;
} else if (b <= 8.5e+45) {
tmp = pow(a, 4.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 <= 1d-209) then
tmp = -1.0d0
else if (b <= 1.35d-176) then
tmp = a ** 4.0d0
else if (b <= 3.4d-115) then
tmp = -1.0d0
else if (b <= 4.4d-71) then
tmp = a ** 4.0d0
else if (b <= 3.8d-52) then
tmp = -1.0d0
else if (b <= 8.5d+45) then
tmp = a ** 4.0d0
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 1e-209) {
tmp = -1.0;
} else if (b <= 1.35e-176) {
tmp = Math.pow(a, 4.0);
} else if (b <= 3.4e-115) {
tmp = -1.0;
} else if (b <= 4.4e-71) {
tmp = Math.pow(a, 4.0);
} else if (b <= 3.8e-52) {
tmp = -1.0;
} else if (b <= 8.5e+45) {
tmp = Math.pow(a, 4.0);
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 1e-209: tmp = -1.0 elif b <= 1.35e-176: tmp = math.pow(a, 4.0) elif b <= 3.4e-115: tmp = -1.0 elif b <= 4.4e-71: tmp = math.pow(a, 4.0) elif b <= 3.8e-52: tmp = -1.0 elif b <= 8.5e+45: tmp = math.pow(a, 4.0) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 1e-209) tmp = -1.0; elseif (b <= 1.35e-176) tmp = a ^ 4.0; elseif (b <= 3.4e-115) tmp = -1.0; elseif (b <= 4.4e-71) tmp = a ^ 4.0; elseif (b <= 3.8e-52) tmp = -1.0; elseif (b <= 8.5e+45) tmp = a ^ 4.0; else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 1e-209) tmp = -1.0; elseif (b <= 1.35e-176) tmp = a ^ 4.0; elseif (b <= 3.4e-115) tmp = -1.0; elseif (b <= 4.4e-71) tmp = a ^ 4.0; elseif (b <= 3.8e-52) tmp = -1.0; elseif (b <= 8.5e+45) tmp = a ^ 4.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 1e-209], -1.0, If[LessEqual[b, 1.35e-176], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[b, 3.4e-115], -1.0, If[LessEqual[b, 4.4e-71], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[b, 3.8e-52], -1.0, If[LessEqual[b, 8.5e+45], N[Power[a, 4.0], $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 10^{-209}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 1.35 \cdot 10^{-176}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;b \leq 3.4 \cdot 10^{-115}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 4.4 \cdot 10^{-71}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{-52}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 8.5 \cdot 10^{+45}:\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 1e-209 or 1.3499999999999999e-176 < b < 3.3999999999999998e-115 or 4.39999999999999995e-71 < b < 3.8000000000000003e-52Initial program 78.8%
associate--l+78.8%
fma-define78.8%
sqr-neg78.8%
fma-define78.8%
distribute-rgt-in78.8%
sqr-neg78.8%
distribute-rgt-in78.8%
fma-define78.8%
sqr-neg78.8%
Simplified79.4%
fma-define79.4%
unpow279.4%
+-commutative79.4%
distribute-lft-in68.9%
fma-define68.9%
add-sqr-sqrt68.9%
pow268.9%
fma-define68.9%
hypot-define68.9%
pow268.9%
fma-define68.9%
add-sqr-sqrt68.9%
pow268.9%
fma-define68.9%
hypot-define68.9%
pow268.9%
Applied egg-rr68.9%
distribute-lft-out79.4%
Simplified79.4%
Taylor expanded in a around inf 83.9%
mul-1-neg83.9%
Simplified83.9%
Taylor expanded in a around 0 68.5%
Taylor expanded in b around 0 38.2%
if 1e-209 < b < 1.3499999999999999e-176 or 3.3999999999999998e-115 < b < 4.39999999999999995e-71 or 3.8000000000000003e-52 < b < 8.4999999999999996e45Initial program 85.2%
associate--l+85.2%
fma-define85.2%
sqr-neg85.2%
fma-define85.2%
distribute-rgt-in85.2%
sqr-neg85.2%
distribute-rgt-in85.2%
fma-define85.2%
sqr-neg85.2%
Simplified85.2%
Taylor expanded in a around inf 67.5%
if 8.4999999999999996e45 < b Initial program 60.7%
associate--l+60.7%
fma-define60.7%
sqr-neg60.7%
fma-define60.7%
distribute-rgt-in60.7%
sqr-neg60.7%
distribute-rgt-in60.7%
fma-define60.7%
sqr-neg60.7%
Simplified66.6%
Taylor expanded in b around inf 91.1%
(FPCore (a b)
:precision binary64
(if (<= a -1.15e+36)
(pow a 4.0)
(if (<= a 1.2e-10)
(+ (pow b 4.0) -1.0)
(+ -1.0 (* (pow a 4.0) (+ 1.0 (/ (+ -4.0 (/ 4.0 a)) a)))))))
double code(double a, double b) {
double tmp;
if (a <= -1.15e+36) {
tmp = pow(a, 4.0);
} else if (a <= 1.2e-10) {
tmp = pow(b, 4.0) + -1.0;
} else {
tmp = -1.0 + (pow(a, 4.0) * (1.0 + ((-4.0 + (4.0 / a)) / a)));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-1.15d+36)) then
tmp = a ** 4.0d0
else if (a <= 1.2d-10) then
tmp = (b ** 4.0d0) + (-1.0d0)
else
tmp = (-1.0d0) + ((a ** 4.0d0) * (1.0d0 + (((-4.0d0) + (4.0d0 / a)) / a)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -1.15e+36) {
tmp = Math.pow(a, 4.0);
} else if (a <= 1.2e-10) {
tmp = Math.pow(b, 4.0) + -1.0;
} else {
tmp = -1.0 + (Math.pow(a, 4.0) * (1.0 + ((-4.0 + (4.0 / a)) / a)));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -1.15e+36: tmp = math.pow(a, 4.0) elif a <= 1.2e-10: tmp = math.pow(b, 4.0) + -1.0 else: tmp = -1.0 + (math.pow(a, 4.0) * (1.0 + ((-4.0 + (4.0 / a)) / a))) return tmp
function code(a, b) tmp = 0.0 if (a <= -1.15e+36) tmp = a ^ 4.0; elseif (a <= 1.2e-10) tmp = Float64((b ^ 4.0) + -1.0); else tmp = Float64(-1.0 + Float64((a ^ 4.0) * Float64(1.0 + Float64(Float64(-4.0 + Float64(4.0 / a)) / a)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -1.15e+36) tmp = a ^ 4.0; elseif (a <= 1.2e-10) tmp = (b ^ 4.0) + -1.0; else tmp = -1.0 + ((a ^ 4.0) * (1.0 + ((-4.0 + (4.0 / a)) / a))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -1.15e+36], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 1.2e-10], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision], N[(-1.0 + N[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 + N[(N[(-4.0 + N[(4.0 / a), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.15 \cdot 10^{+36}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 1.2 \cdot 10^{-10}:\\
\;\;\;\;{b}^{4} + -1\\
\mathbf{else}:\\
\;\;\;\;-1 + {a}^{4} \cdot \left(1 + \frac{-4 + \frac{4}{a}}{a}\right)\\
\end{array}
\end{array}
if a < -1.14999999999999998e36Initial program 62.2%
associate--l+62.2%
fma-define62.2%
sqr-neg62.2%
fma-define62.2%
distribute-rgt-in62.2%
sqr-neg62.2%
distribute-rgt-in62.2%
fma-define62.2%
sqr-neg62.2%
Simplified62.2%
Taylor expanded in a around inf 95.7%
if -1.14999999999999998e36 < a < 1.2e-10Initial program 99.2%
associate--l+99.2%
fma-define99.2%
sqr-neg99.2%
fma-define99.2%
distribute-rgt-in99.2%
sqr-neg99.2%
distribute-rgt-in99.2%
fma-define99.2%
sqr-neg99.2%
Simplified99.2%
fma-define99.2%
unpow299.2%
+-commutative99.2%
distribute-lft-in85.7%
fma-define85.7%
add-sqr-sqrt85.7%
pow285.7%
fma-define85.7%
hypot-define85.7%
pow285.7%
fma-define85.7%
add-sqr-sqrt85.7%
pow285.7%
fma-define85.7%
hypot-define85.7%
pow285.7%
Applied egg-rr85.7%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in a around inf 97.7%
mul-1-neg97.7%
Simplified97.7%
Taylor expanded in a around 0 97.5%
if 1.2e-10 < a Initial program 39.2%
associate--l+39.2%
fma-define39.2%
sqr-neg39.2%
fma-define39.2%
distribute-rgt-in39.2%
sqr-neg39.2%
distribute-rgt-in39.2%
fma-define39.2%
sqr-neg39.2%
Simplified45.7%
Taylor expanded in b around 0 33.0%
Taylor expanded in a around -inf 93.7%
associate-*r/93.7%
sub-neg93.7%
associate-*r/93.7%
metadata-eval93.7%
distribute-neg-frac93.7%
metadata-eval93.7%
distribute-rgt-in93.7%
metadata-eval93.7%
associate-*l/93.7%
metadata-eval93.7%
Simplified93.7%
Final simplification96.1%
(FPCore (a b)
:precision binary64
(if (<= a -2.15e+36)
(pow a 4.0)
(if (<= a 1.2e-10)
(+ (pow b 4.0) -1.0)
(+ -1.0 (* (pow a 2.0) (+ 4.0 (* a (- a 4.0))))))))
double code(double a, double b) {
double tmp;
if (a <= -2.15e+36) {
tmp = pow(a, 4.0);
} else if (a <= 1.2e-10) {
tmp = pow(b, 4.0) + -1.0;
} else {
tmp = -1.0 + (pow(a, 2.0) * (4.0 + (a * (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 <= (-2.15d+36)) then
tmp = a ** 4.0d0
else if (a <= 1.2d-10) then
tmp = (b ** 4.0d0) + (-1.0d0)
else
tmp = (-1.0d0) + ((a ** 2.0d0) * (4.0d0 + (a * (a - 4.0d0))))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -2.15e+36) {
tmp = Math.pow(a, 4.0);
} else if (a <= 1.2e-10) {
tmp = Math.pow(b, 4.0) + -1.0;
} else {
tmp = -1.0 + (Math.pow(a, 2.0) * (4.0 + (a * (a - 4.0))));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -2.15e+36: tmp = math.pow(a, 4.0) elif a <= 1.2e-10: tmp = math.pow(b, 4.0) + -1.0 else: tmp = -1.0 + (math.pow(a, 2.0) * (4.0 + (a * (a - 4.0)))) return tmp
function code(a, b) tmp = 0.0 if (a <= -2.15e+36) tmp = a ^ 4.0; elseif (a <= 1.2e-10) tmp = Float64((b ^ 4.0) + -1.0); else tmp = Float64(-1.0 + Float64((a ^ 2.0) * Float64(4.0 + Float64(a * Float64(a - 4.0))))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2.15e+36) tmp = a ^ 4.0; elseif (a <= 1.2e-10) tmp = (b ^ 4.0) + -1.0; else tmp = -1.0 + ((a ^ 2.0) * (4.0 + (a * (a - 4.0)))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -2.15e+36], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 1.2e-10], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision], N[(-1.0 + N[(N[Power[a, 2.0], $MachinePrecision] * N[(4.0 + N[(a * N[(a - 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.15 \cdot 10^{+36}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 1.2 \cdot 10^{-10}:\\
\;\;\;\;{b}^{4} + -1\\
\mathbf{else}:\\
\;\;\;\;-1 + {a}^{2} \cdot \left(4 + a \cdot \left(a - 4\right)\right)\\
\end{array}
\end{array}
if a < -2.15000000000000002e36Initial program 62.2%
associate--l+62.2%
fma-define62.2%
sqr-neg62.2%
fma-define62.2%
distribute-rgt-in62.2%
sqr-neg62.2%
distribute-rgt-in62.2%
fma-define62.2%
sqr-neg62.2%
Simplified62.2%
Taylor expanded in a around inf 95.7%
if -2.15000000000000002e36 < a < 1.2e-10Initial program 99.2%
associate--l+99.2%
fma-define99.2%
sqr-neg99.2%
fma-define99.2%
distribute-rgt-in99.2%
sqr-neg99.2%
distribute-rgt-in99.2%
fma-define99.2%
sqr-neg99.2%
Simplified99.2%
fma-define99.2%
unpow299.2%
+-commutative99.2%
distribute-lft-in85.7%
fma-define85.7%
add-sqr-sqrt85.7%
pow285.7%
fma-define85.7%
hypot-define85.7%
pow285.7%
fma-define85.7%
add-sqr-sqrt85.7%
pow285.7%
fma-define85.7%
hypot-define85.7%
pow285.7%
Applied egg-rr85.7%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in a around inf 97.7%
mul-1-neg97.7%
Simplified97.7%
Taylor expanded in a around 0 97.5%
if 1.2e-10 < a Initial program 39.2%
associate--l+39.2%
fma-define39.2%
sqr-neg39.2%
fma-define39.2%
distribute-rgt-in39.2%
sqr-neg39.2%
distribute-rgt-in39.2%
fma-define39.2%
sqr-neg39.2%
Simplified45.7%
Taylor expanded in b around 0 33.0%
Taylor expanded in a around 0 93.6%
Final simplification96.1%
(FPCore (a b)
:precision binary64
(if (<= a -3.7e+34)
(pow a 4.0)
(if (<= a 1100000000.0)
(+ (pow b 4.0) -1.0)
(* (pow a 4.0) (+ -1.0 (+ 2.0 (/ -4.0 a)))))))
double code(double a, double b) {
double tmp;
if (a <= -3.7e+34) {
tmp = pow(a, 4.0);
} else if (a <= 1100000000.0) {
tmp = pow(b, 4.0) + -1.0;
} else {
tmp = pow(a, 4.0) * (-1.0 + (2.0 + (-4.0 / a)));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-3.7d+34)) then
tmp = a ** 4.0d0
else if (a <= 1100000000.0d0) then
tmp = (b ** 4.0d0) + (-1.0d0)
else
tmp = (a ** 4.0d0) * ((-1.0d0) + (2.0d0 + ((-4.0d0) / a)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -3.7e+34) {
tmp = Math.pow(a, 4.0);
} else if (a <= 1100000000.0) {
tmp = Math.pow(b, 4.0) + -1.0;
} else {
tmp = Math.pow(a, 4.0) * (-1.0 + (2.0 + (-4.0 / a)));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -3.7e+34: tmp = math.pow(a, 4.0) elif a <= 1100000000.0: tmp = math.pow(b, 4.0) + -1.0 else: tmp = math.pow(a, 4.0) * (-1.0 + (2.0 + (-4.0 / a))) return tmp
function code(a, b) tmp = 0.0 if (a <= -3.7e+34) tmp = a ^ 4.0; elseif (a <= 1100000000.0) tmp = Float64((b ^ 4.0) + -1.0); else tmp = Float64((a ^ 4.0) * Float64(-1.0 + Float64(2.0 + Float64(-4.0 / a)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -3.7e+34) tmp = a ^ 4.0; elseif (a <= 1100000000.0) tmp = (b ^ 4.0) + -1.0; else tmp = (a ^ 4.0) * (-1.0 + (2.0 + (-4.0 / a))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -3.7e+34], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 1100000000.0], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[a, 4.0], $MachinePrecision] * N[(-1.0 + N[(2.0 + N[(-4.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.7 \cdot 10^{+34}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 1100000000:\\
\;\;\;\;{b}^{4} + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{4} \cdot \left(-1 + \left(2 + \frac{-4}{a}\right)\right)\\
\end{array}
\end{array}
if a < -3.70000000000000009e34Initial program 62.2%
associate--l+62.2%
fma-define62.2%
sqr-neg62.2%
fma-define62.2%
distribute-rgt-in62.2%
sqr-neg62.2%
distribute-rgt-in62.2%
fma-define62.2%
sqr-neg62.2%
Simplified62.2%
Taylor expanded in a around inf 95.7%
if -3.70000000000000009e34 < a < 1.1e9Initial program 99.2%
associate--l+99.2%
fma-define99.2%
sqr-neg99.2%
fma-define99.2%
distribute-rgt-in99.2%
sqr-neg99.2%
distribute-rgt-in99.2%
fma-define99.2%
sqr-neg99.2%
Simplified99.2%
fma-define99.2%
unpow299.2%
+-commutative99.2%
distribute-lft-in86.4%
fma-define86.4%
add-sqr-sqrt86.4%
pow286.4%
fma-define86.4%
hypot-define86.4%
pow286.4%
fma-define86.4%
add-sqr-sqrt86.4%
pow286.4%
fma-define86.4%
hypot-define86.4%
pow286.4%
Applied egg-rr86.4%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in a around inf 96.2%
mul-1-neg96.2%
Simplified96.2%
Taylor expanded in a around 0 95.9%
if 1.1e9 < a Initial program 31.4%
associate--l+31.4%
fma-define31.4%
sqr-neg31.4%
fma-define31.4%
distribute-rgt-in31.4%
sqr-neg31.4%
distribute-rgt-in31.4%
fma-define31.4%
sqr-neg31.4%
Simplified38.8%
Taylor expanded in a around inf 96.4%
associate-*r/96.4%
metadata-eval96.4%
Simplified96.4%
expm1-log1p-u96.5%
sub-neg96.5%
distribute-neg-frac96.5%
metadata-eval96.5%
Applied egg-rr96.5%
expm1-undefine96.5%
sub-neg96.5%
log1p-undefine96.4%
rem-exp-log96.4%
associate-+r+96.5%
metadata-eval96.5%
metadata-eval96.5%
Simplified96.5%
Final simplification96.0%
(FPCore (a b)
:precision binary64
(if (<= a -3.6e+34)
(pow a 4.0)
(if (<= a 265000000.0)
(+ (pow b 4.0) -1.0)
(* (pow a 4.0) (- 1.0 (/ 4.0 a))))))
double code(double a, double b) {
double tmp;
if (a <= -3.6e+34) {
tmp = pow(a, 4.0);
} else if (a <= 265000000.0) {
tmp = pow(b, 4.0) + -1.0;
} else {
tmp = pow(a, 4.0) * (1.0 - (4.0 / a));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-3.6d+34)) then
tmp = a ** 4.0d0
else if (a <= 265000000.0d0) then
tmp = (b ** 4.0d0) + (-1.0d0)
else
tmp = (a ** 4.0d0) * (1.0d0 - (4.0d0 / a))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -3.6e+34) {
tmp = Math.pow(a, 4.0);
} else if (a <= 265000000.0) {
tmp = Math.pow(b, 4.0) + -1.0;
} else {
tmp = Math.pow(a, 4.0) * (1.0 - (4.0 / a));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -3.6e+34: tmp = math.pow(a, 4.0) elif a <= 265000000.0: tmp = math.pow(b, 4.0) + -1.0 else: tmp = math.pow(a, 4.0) * (1.0 - (4.0 / a)) return tmp
function code(a, b) tmp = 0.0 if (a <= -3.6e+34) tmp = a ^ 4.0; elseif (a <= 265000000.0) tmp = Float64((b ^ 4.0) + -1.0); else tmp = Float64((a ^ 4.0) * Float64(1.0 - Float64(4.0 / a))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -3.6e+34) tmp = a ^ 4.0; elseif (a <= 265000000.0) tmp = (b ^ 4.0) + -1.0; else tmp = (a ^ 4.0) * (1.0 - (4.0 / a)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -3.6e+34], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 265000000.0], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 - N[(4.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.6 \cdot 10^{+34}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 265000000:\\
\;\;\;\;{b}^{4} + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{4} \cdot \left(1 - \frac{4}{a}\right)\\
\end{array}
\end{array}
if a < -3.6e34Initial program 62.2%
associate--l+62.2%
fma-define62.2%
sqr-neg62.2%
fma-define62.2%
distribute-rgt-in62.2%
sqr-neg62.2%
distribute-rgt-in62.2%
fma-define62.2%
sqr-neg62.2%
Simplified62.2%
Taylor expanded in a around inf 95.7%
if -3.6e34 < a < 2.65e8Initial program 99.2%
associate--l+99.2%
fma-define99.2%
sqr-neg99.2%
fma-define99.2%
distribute-rgt-in99.2%
sqr-neg99.2%
distribute-rgt-in99.2%
fma-define99.2%
sqr-neg99.2%
Simplified99.2%
fma-define99.2%
unpow299.2%
+-commutative99.2%
distribute-lft-in86.4%
fma-define86.4%
add-sqr-sqrt86.4%
pow286.4%
fma-define86.4%
hypot-define86.4%
pow286.4%
fma-define86.4%
add-sqr-sqrt86.4%
pow286.4%
fma-define86.4%
hypot-define86.4%
pow286.4%
Applied egg-rr86.4%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in a around inf 96.2%
mul-1-neg96.2%
Simplified96.2%
Taylor expanded in a around 0 95.9%
if 2.65e8 < a Initial program 31.4%
associate--l+31.4%
fma-define31.4%
sqr-neg31.4%
fma-define31.4%
distribute-rgt-in31.4%
sqr-neg31.4%
distribute-rgt-in31.4%
fma-define31.4%
sqr-neg31.4%
Simplified38.8%
Taylor expanded in a around inf 96.4%
associate-*r/96.4%
metadata-eval96.4%
Simplified96.4%
Final simplification96.0%
(FPCore (a b) :precision binary64 (if (<= a -3.2e+34) (pow a 4.0) (if (<= a 240000000.0) (+ (pow b 4.0) -1.0) (* (- a 4.0) (pow a 3.0)))))
double code(double a, double b) {
double tmp;
if (a <= -3.2e+34) {
tmp = pow(a, 4.0);
} else if (a <= 240000000.0) {
tmp = pow(b, 4.0) + -1.0;
} else {
tmp = (a - 4.0) * pow(a, 3.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-3.2d+34)) then
tmp = a ** 4.0d0
else if (a <= 240000000.0d0) then
tmp = (b ** 4.0d0) + (-1.0d0)
else
tmp = (a - 4.0d0) * (a ** 3.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -3.2e+34) {
tmp = Math.pow(a, 4.0);
} else if (a <= 240000000.0) {
tmp = Math.pow(b, 4.0) + -1.0;
} else {
tmp = (a - 4.0) * Math.pow(a, 3.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -3.2e+34: tmp = math.pow(a, 4.0) elif a <= 240000000.0: tmp = math.pow(b, 4.0) + -1.0 else: tmp = (a - 4.0) * math.pow(a, 3.0) return tmp
function code(a, b) tmp = 0.0 if (a <= -3.2e+34) tmp = a ^ 4.0; elseif (a <= 240000000.0) tmp = Float64((b ^ 4.0) + -1.0); else tmp = Float64(Float64(a - 4.0) * (a ^ 3.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -3.2e+34) tmp = a ^ 4.0; elseif (a <= 240000000.0) tmp = (b ^ 4.0) + -1.0; else tmp = (a - 4.0) * (a ^ 3.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -3.2e+34], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 240000000.0], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(a - 4.0), $MachinePrecision] * N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.2 \cdot 10^{+34}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 240000000:\\
\;\;\;\;{b}^{4} + -1\\
\mathbf{else}:\\
\;\;\;\;\left(a - 4\right) \cdot {a}^{3}\\
\end{array}
\end{array}
if a < -3.1999999999999998e34Initial program 62.2%
associate--l+62.2%
fma-define62.2%
sqr-neg62.2%
fma-define62.2%
distribute-rgt-in62.2%
sqr-neg62.2%
distribute-rgt-in62.2%
fma-define62.2%
sqr-neg62.2%
Simplified62.2%
Taylor expanded in a around inf 95.7%
if -3.1999999999999998e34 < a < 2.4e8Initial program 99.2%
associate--l+99.2%
fma-define99.2%
sqr-neg99.2%
fma-define99.2%
distribute-rgt-in99.2%
sqr-neg99.2%
distribute-rgt-in99.2%
fma-define99.2%
sqr-neg99.2%
Simplified99.2%
fma-define99.2%
unpow299.2%
+-commutative99.2%
distribute-lft-in86.4%
fma-define86.4%
add-sqr-sqrt86.4%
pow286.4%
fma-define86.4%
hypot-define86.4%
pow286.4%
fma-define86.4%
add-sqr-sqrt86.4%
pow286.4%
fma-define86.4%
hypot-define86.4%
pow286.4%
Applied egg-rr86.4%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in a around inf 96.2%
mul-1-neg96.2%
Simplified96.2%
Taylor expanded in a around 0 95.9%
if 2.4e8 < a Initial program 31.4%
associate--l+31.4%
fma-define31.4%
sqr-neg31.4%
fma-define31.4%
distribute-rgt-in31.4%
sqr-neg31.4%
distribute-rgt-in31.4%
fma-define31.4%
sqr-neg31.4%
Simplified38.8%
Taylor expanded in a around inf 96.4%
associate-*r/96.4%
metadata-eval96.4%
Simplified96.4%
Taylor expanded in a around 0 96.4%
Final simplification96.0%
(FPCore (a b) :precision binary64 (if (or (<= a -3.6e+34) (not (<= a 7e+14))) (pow a 4.0) (+ (pow b 4.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((a <= -3.6e+34) || !(a <= 7e+14)) {
tmp = pow(a, 4.0);
} else {
tmp = pow(b, 4.0) + -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 <= (-3.6d+34)) .or. (.not. (a <= 7d+14))) then
tmp = a ** 4.0d0
else
tmp = (b ** 4.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -3.6e+34) || !(a <= 7e+14)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = Math.pow(b, 4.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -3.6e+34) or not (a <= 7e+14): tmp = math.pow(a, 4.0) else: tmp = math.pow(b, 4.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -3.6e+34) || !(a <= 7e+14)) tmp = a ^ 4.0; else tmp = Float64((b ^ 4.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -3.6e+34) || ~((a <= 7e+14))) tmp = a ^ 4.0; else tmp = (b ^ 4.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -3.6e+34], N[Not[LessEqual[a, 7e+14]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.6 \cdot 10^{+34} \lor \neg \left(a \leq 7 \cdot 10^{+14}\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4} + -1\\
\end{array}
\end{array}
if a < -3.6e34 or 7e14 < a Initial program 46.8%
associate--l+46.8%
fma-define46.8%
sqr-neg46.8%
fma-define46.8%
distribute-rgt-in46.8%
sqr-neg46.8%
distribute-rgt-in46.8%
fma-define46.8%
sqr-neg46.8%
Simplified50.4%
Taylor expanded in a around inf 96.8%
if -3.6e34 < a < 7e14Initial program 99.2%
associate--l+99.2%
fma-define99.2%
sqr-neg99.2%
fma-define99.2%
distribute-rgt-in99.2%
sqr-neg99.2%
distribute-rgt-in99.2%
fma-define99.2%
sqr-neg99.2%
Simplified99.2%
fma-define99.2%
unpow299.2%
+-commutative99.2%
distribute-lft-in86.6%
fma-define86.6%
add-sqr-sqrt86.6%
pow286.6%
fma-define86.6%
hypot-define86.6%
pow286.6%
fma-define86.6%
add-sqr-sqrt86.6%
pow286.6%
fma-define86.6%
hypot-define86.6%
pow286.6%
Applied egg-rr86.6%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in a around inf 96.2%
mul-1-neg96.2%
Simplified96.2%
Taylor expanded in a around 0 95.3%
Final simplification96.0%
(FPCore (a b) :precision binary64 (if (or (<= a -0.41) (not (<= a 2.4))) (pow a 4.0) -1.0))
double code(double a, double b) {
double tmp;
if ((a <= -0.41) || !(a <= 2.4)) {
tmp = pow(a, 4.0);
} 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.41d0)) .or. (.not. (a <= 2.4d0))) then
tmp = a ** 4.0d0
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -0.41) || !(a <= 2.4)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -0.41) or not (a <= 2.4): tmp = math.pow(a, 4.0) else: tmp = -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -0.41) || !(a <= 2.4)) tmp = a ^ 4.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -0.41) || ~((a <= 2.4))) tmp = a ^ 4.0; else tmp = -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -0.41], N[Not[LessEqual[a, 2.4]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], -1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.41 \lor \neg \left(a \leq 2.4\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if a < -0.409999999999999976 or 2.39999999999999991 < a Initial program 50.3%
associate--l+50.3%
fma-define50.3%
sqr-neg50.3%
fma-define50.3%
distribute-rgt-in50.3%
sqr-neg50.3%
distribute-rgt-in50.3%
fma-define50.3%
sqr-neg50.3%
Simplified53.5%
Taylor expanded in a around inf 90.0%
if -0.409999999999999976 < a < 2.39999999999999991Initial program 99.9%
associate--l+99.9%
fma-define99.9%
sqr-neg99.9%
fma-define99.9%
distribute-rgt-in99.9%
sqr-neg99.9%
distribute-rgt-in99.9%
fma-define99.9%
sqr-neg99.9%
Simplified99.9%
fma-define99.9%
unpow299.9%
+-commutative99.9%
distribute-lft-in86.4%
fma-define86.4%
add-sqr-sqrt86.4%
pow286.4%
fma-define86.4%
hypot-define86.4%
pow286.4%
fma-define86.4%
add-sqr-sqrt86.4%
pow286.4%
fma-define86.4%
hypot-define86.4%
pow286.4%
Applied egg-rr86.4%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in a around inf 97.1%
mul-1-neg97.1%
Simplified97.1%
Taylor expanded in a around 0 97.1%
Taylor expanded in b around 0 54.2%
Final simplification71.4%
(FPCore (a b) :precision binary64 (if (<= b 1e+46) (+ -1.0 (pow a 4.0)) (pow b 4.0)))
double code(double a, double b) {
double tmp;
if (b <= 1e+46) {
tmp = -1.0 + pow(a, 4.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 <= 1d+46) then
tmp = (-1.0d0) + (a ** 4.0d0)
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 1e+46) {
tmp = -1.0 + Math.pow(a, 4.0);
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 1e+46: tmp = -1.0 + math.pow(a, 4.0) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 1e+46) tmp = Float64(-1.0 + (a ^ 4.0)); else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 1e+46) tmp = -1.0 + (a ^ 4.0); else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 1e+46], N[(-1.0 + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 10^{+46}:\\
\;\;\;\;-1 + {a}^{4}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 9.9999999999999999e45Initial program 79.9%
associate--l+79.9%
fma-define79.9%
sqr-neg79.9%
fma-define79.9%
distribute-rgt-in79.9%
sqr-neg79.9%
distribute-rgt-in79.9%
fma-define79.9%
sqr-neg79.9%
Simplified80.4%
fma-define80.4%
unpow280.4%
+-commutative80.4%
distribute-lft-in70.6%
fma-define70.6%
add-sqr-sqrt70.6%
pow270.6%
fma-define70.6%
hypot-define70.6%
pow270.6%
fma-define70.6%
add-sqr-sqrt70.6%
pow270.6%
fma-define70.6%
hypot-define70.6%
pow270.6%
Applied egg-rr70.6%
distribute-lft-out80.4%
Simplified80.4%
Taylor expanded in a around inf 84.2%
mul-1-neg84.2%
Simplified84.2%
Taylor expanded in a around 0 92.5%
sub-neg92.5%
fma-define92.5%
fma-define92.5%
sub-neg92.5%
metadata-eval92.5%
metadata-eval92.5%
Simplified92.5%
Taylor expanded in a around inf 79.1%
if 9.9999999999999999e45 < b Initial program 60.7%
associate--l+60.7%
fma-define60.7%
sqr-neg60.7%
fma-define60.7%
distribute-rgt-in60.7%
sqr-neg60.7%
distribute-rgt-in60.7%
fma-define60.7%
sqr-neg60.7%
Simplified66.6%
Taylor expanded in b around inf 91.1%
Final simplification81.5%
(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 76.1%
associate--l+76.1%
fma-define76.1%
sqr-neg76.1%
fma-define76.1%
distribute-rgt-in76.1%
sqr-neg76.1%
distribute-rgt-in76.1%
fma-define76.1%
sqr-neg76.1%
Simplified77.6%
fma-define77.6%
unpow277.6%
+-commutative77.6%
distribute-lft-in66.7%
fma-define66.7%
add-sqr-sqrt66.7%
pow266.7%
fma-define66.7%
hypot-define66.7%
pow266.7%
fma-define66.7%
add-sqr-sqrt66.7%
pow266.7%
fma-define66.7%
hypot-define66.7%
pow266.7%
Applied egg-rr66.7%
distribute-lft-out77.6%
Simplified77.6%
Taylor expanded in a around inf 83.4%
mul-1-neg83.4%
Simplified83.4%
Taylor expanded in a around 0 68.0%
Taylor expanded in b around 0 28.5%
herbie shell --seed 2024097
(FPCore (a b)
:name "Bouland and Aaronson, Equation (24)"
:precision binary64
(- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ 3.0 a))))) 1.0))