
(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
(if (<=
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ a 3.0)))))
INFINITY)
(+
(pow (hypot a b) 4.0)
(fma 4.0 (- (fma (* b b) (+ a 3.0) (* a a)) (pow a 3.0)) -1.0))
(+ -1.0 (pow a 4.0))))
double code(double a, double b) {
double tmp;
if ((pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))))) <= ((double) INFINITY)) {
tmp = pow(hypot(a, b), 4.0) + fma(4.0, (fma((b * b), (a + 3.0), (a * a)) - pow(a, 3.0)), -1.0);
} else {
tmp = -1.0 + pow(a, 4.0);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (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))))) <= Inf) tmp = Float64((hypot(a, b) ^ 4.0) + fma(4.0, Float64(fma(Float64(b * b), Float64(a + 3.0), Float64(a * a)) - (a ^ 3.0)), -1.0)); else tmp = Float64(-1.0 + (a ^ 4.0)); end return tmp end
code[a_, b_] := If[LessEqual[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], Infinity], N[(N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(b * b), $MachinePrecision] * N[(a + 3.0), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision] - N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\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) \leq \infty:\\
\;\;\;\;{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(4, \mathsf{fma}\left(b \cdot b, a + 3, a \cdot a\right) - {a}^{3}, -1\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + {a}^{4}\\
\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 3 a))))) < +inf.0Initial program 99.9%
associate--l+99.9%
Simplified99.9%
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 3 a))))) Initial program 0.0%
sub-neg0.0%
fma-def0.0%
fma-def3.4%
+-commutative3.4%
metadata-eval3.4%
Simplified3.4%
Taylor expanded in a around inf 98.4%
Final simplification99.6%
(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) (+ -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 = -1.0 + 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 = -1.0 + 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 = -1.0 + 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 = Float64(-1.0 + (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 = -1.0 + (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[(-1.0 + N[Power[a, 4.0], $MachinePrecision]), $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}:\\
\;\;\;\;-1 + {a}^{4}\\
\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 3 a))))) < +inf.0Initial program 99.9%
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 3 a))))) Initial program 0.0%
sub-neg0.0%
fma-def0.0%
fma-def3.4%
+-commutative3.4%
metadata-eval3.4%
Simplified3.4%
Taylor expanded in a around inf 98.4%
Final simplification99.5%
(FPCore (a b)
:precision binary64
(if (<= a -0.00285)
(+ -1.0 (+ (pow a 4.0) (* (- 1.0 a) (* (* a a) 4.0))))
(if (<= a 4.5e+55)
(+ -1.0 (+ (* (* b b) 12.0) (pow b 4.0)))
(+ -1.0 (pow a 4.0)))))
double code(double a, double b) {
double tmp;
if (a <= -0.00285) {
tmp = -1.0 + (pow(a, 4.0) + ((1.0 - a) * ((a * a) * 4.0)));
} else if (a <= 4.5e+55) {
tmp = -1.0 + (((b * b) * 12.0) + pow(b, 4.0));
} else {
tmp = -1.0 + 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 <= (-0.00285d0)) then
tmp = (-1.0d0) + ((a ** 4.0d0) + ((1.0d0 - a) * ((a * a) * 4.0d0)))
else if (a <= 4.5d+55) then
tmp = (-1.0d0) + (((b * b) * 12.0d0) + (b ** 4.0d0))
else
tmp = (-1.0d0) + (a ** 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -0.00285) {
tmp = -1.0 + (Math.pow(a, 4.0) + ((1.0 - a) * ((a * a) * 4.0)));
} else if (a <= 4.5e+55) {
tmp = -1.0 + (((b * b) * 12.0) + Math.pow(b, 4.0));
} else {
tmp = -1.0 + Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -0.00285: tmp = -1.0 + (math.pow(a, 4.0) + ((1.0 - a) * ((a * a) * 4.0))) elif a <= 4.5e+55: tmp = -1.0 + (((b * b) * 12.0) + math.pow(b, 4.0)) else: tmp = -1.0 + math.pow(a, 4.0) return tmp
function code(a, b) tmp = 0.0 if (a <= -0.00285) tmp = Float64(-1.0 + Float64((a ^ 4.0) + Float64(Float64(1.0 - a) * Float64(Float64(a * a) * 4.0)))); elseif (a <= 4.5e+55) tmp = Float64(-1.0 + Float64(Float64(Float64(b * b) * 12.0) + (b ^ 4.0))); else tmp = Float64(-1.0 + (a ^ 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -0.00285) tmp = -1.0 + ((a ^ 4.0) + ((1.0 - a) * ((a * a) * 4.0))); elseif (a <= 4.5e+55) tmp = -1.0 + (((b * b) * 12.0) + (b ^ 4.0)); else tmp = -1.0 + (a ^ 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -0.00285], N[(-1.0 + N[(N[Power[a, 4.0], $MachinePrecision] + N[(N[(1.0 - a), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 4.5e+55], N[(-1.0 + N[(N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision] + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.00285:\\
\;\;\;\;-1 + \left({a}^{4} + \left(1 - a\right) \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right)\\
\mathbf{elif}\;a \leq 4.5 \cdot 10^{+55}:\\
\;\;\;\;-1 + \left(\left(b \cdot b\right) \cdot 12 + {b}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + {a}^{4}\\
\end{array}
\end{array}
if a < -0.0028500000000000001Initial program 64.5%
sub-neg64.5%
fma-def64.5%
fma-def64.5%
+-commutative64.5%
metadata-eval64.5%
Simplified64.5%
Taylor expanded in b around 0 96.1%
associate-*r*96.1%
unpow296.1%
Simplified96.1%
if -0.0028500000000000001 < a < 4.49999999999999998e55Initial program 99.9%
sub-neg99.9%
fma-def99.9%
fma-def99.9%
+-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in a around 0 84.7%
associate-+r+84.7%
associate-*r*84.7%
distribute-rgt-out95.7%
metadata-eval95.7%
distribute-lft-in95.7%
unpow295.7%
distribute-rgt-in95.7%
metadata-eval95.7%
Simplified95.7%
Taylor expanded in a around 0 95.7%
unpow295.7%
Simplified95.7%
if 4.49999999999999998e55 < a Initial program 22.2%
sub-neg22.2%
fma-def22.2%
fma-def25.9%
+-commutative25.9%
metadata-eval25.9%
Simplified25.9%
Taylor expanded in a around inf 100.0%
Final simplification96.7%
(FPCore (a b)
:precision binary64
(if (<= a -0.019)
(+ -1.0 (* (pow a 3.0) (+ a -4.0)))
(if (<= a 9.5e+54)
(+ -1.0 (+ (* (* b b) 12.0) (pow b 4.0)))
(+ -1.0 (pow a 4.0)))))
double code(double a, double b) {
double tmp;
if (a <= -0.019) {
tmp = -1.0 + (pow(a, 3.0) * (a + -4.0));
} else if (a <= 9.5e+54) {
tmp = -1.0 + (((b * b) * 12.0) + pow(b, 4.0));
} else {
tmp = -1.0 + 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 <= (-0.019d0)) then
tmp = (-1.0d0) + ((a ** 3.0d0) * (a + (-4.0d0)))
else if (a <= 9.5d+54) then
tmp = (-1.0d0) + (((b * b) * 12.0d0) + (b ** 4.0d0))
else
tmp = (-1.0d0) + (a ** 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -0.019) {
tmp = -1.0 + (Math.pow(a, 3.0) * (a + -4.0));
} else if (a <= 9.5e+54) {
tmp = -1.0 + (((b * b) * 12.0) + Math.pow(b, 4.0));
} else {
tmp = -1.0 + Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -0.019: tmp = -1.0 + (math.pow(a, 3.0) * (a + -4.0)) elif a <= 9.5e+54: tmp = -1.0 + (((b * b) * 12.0) + math.pow(b, 4.0)) else: tmp = -1.0 + math.pow(a, 4.0) return tmp
function code(a, b) tmp = 0.0 if (a <= -0.019) tmp = Float64(-1.0 + Float64((a ^ 3.0) * Float64(a + -4.0))); elseif (a <= 9.5e+54) tmp = Float64(-1.0 + Float64(Float64(Float64(b * b) * 12.0) + (b ^ 4.0))); else tmp = Float64(-1.0 + (a ^ 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -0.019) tmp = -1.0 + ((a ^ 3.0) * (a + -4.0)); elseif (a <= 9.5e+54) tmp = -1.0 + (((b * b) * 12.0) + (b ^ 4.0)); else tmp = -1.0 + (a ^ 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -0.019], N[(-1.0 + N[(N[Power[a, 3.0], $MachinePrecision] * N[(a + -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 9.5e+54], N[(-1.0 + N[(N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision] + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.019:\\
\;\;\;\;-1 + {a}^{3} \cdot \left(a + -4\right)\\
\mathbf{elif}\;a \leq 9.5 \cdot 10^{+54}:\\
\;\;\;\;-1 + \left(\left(b \cdot b\right) \cdot 12 + {b}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + {a}^{4}\\
\end{array}
\end{array}
if a < -0.0189999999999999995Initial program 64.5%
sub-neg64.5%
fma-def64.5%
fma-def64.5%
+-commutative64.5%
metadata-eval64.5%
Simplified64.5%
Taylor expanded in b around 0 96.1%
associate-*r*96.1%
unpow296.1%
Simplified96.1%
flip-+8.6%
pow-prod-up8.5%
metadata-eval8.5%
pow28.5%
*-commutative8.5%
*-commutative8.5%
Applied egg-rr8.5%
associate-*r*8.5%
associate-*r*8.5%
Simplified8.5%
unpow28.5%
associate-*r*8.5%
associate-*l*8.5%
*-commutative8.5%
associate-*l*8.5%
pow28.5%
metadata-eval8.5%
associate-*l*8.5%
metadata-eval8.5%
pow28.5%
Applied egg-rr8.5%
Taylor expanded in a around inf 94.6%
*-commutative94.6%
metadata-eval94.6%
pow-plus94.6%
distribute-lft-out94.6%
Simplified94.6%
if -0.0189999999999999995 < a < 9.4999999999999999e54Initial program 99.9%
sub-neg99.9%
fma-def99.9%
fma-def99.9%
+-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in a around 0 84.7%
associate-+r+84.7%
associate-*r*84.7%
distribute-rgt-out95.7%
metadata-eval95.7%
distribute-lft-in95.7%
unpow295.7%
distribute-rgt-in95.7%
metadata-eval95.7%
Simplified95.7%
Taylor expanded in a around 0 95.7%
unpow295.7%
Simplified95.7%
if 9.4999999999999999e54 < a Initial program 22.2%
sub-neg22.2%
fma-def22.2%
fma-def25.9%
+-commutative25.9%
metadata-eval25.9%
Simplified25.9%
Taylor expanded in a around inf 100.0%
Final simplification96.4%
(FPCore (a b)
:precision binary64
(if (<= a -0.019)
(+ -1.0 (* (pow a 3.0) (+ a -4.0)))
(if (<= a 5.1e+54)
(+ -1.0 (* b (* b (fma b b 12.0))))
(+ -1.0 (pow a 4.0)))))
double code(double a, double b) {
double tmp;
if (a <= -0.019) {
tmp = -1.0 + (pow(a, 3.0) * (a + -4.0));
} else if (a <= 5.1e+54) {
tmp = -1.0 + (b * (b * fma(b, b, 12.0)));
} else {
tmp = -1.0 + pow(a, 4.0);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (a <= -0.019) tmp = Float64(-1.0 + Float64((a ^ 3.0) * Float64(a + -4.0))); elseif (a <= 5.1e+54) tmp = Float64(-1.0 + Float64(b * Float64(b * fma(b, b, 12.0)))); else tmp = Float64(-1.0 + (a ^ 4.0)); end return tmp end
code[a_, b_] := If[LessEqual[a, -0.019], N[(-1.0 + N[(N[Power[a, 3.0], $MachinePrecision] * N[(a + -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.1e+54], N[(-1.0 + N[(b * N[(b * N[(b * b + 12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.019:\\
\;\;\;\;-1 + {a}^{3} \cdot \left(a + -4\right)\\
\mathbf{elif}\;a \leq 5.1 \cdot 10^{+54}:\\
\;\;\;\;-1 + b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 12\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + {a}^{4}\\
\end{array}
\end{array}
if a < -0.0189999999999999995Initial program 64.5%
sub-neg64.5%
fma-def64.5%
fma-def64.5%
+-commutative64.5%
metadata-eval64.5%
Simplified64.5%
Taylor expanded in b around 0 96.1%
associate-*r*96.1%
unpow296.1%
Simplified96.1%
flip-+8.6%
pow-prod-up8.5%
metadata-eval8.5%
pow28.5%
*-commutative8.5%
*-commutative8.5%
Applied egg-rr8.5%
associate-*r*8.5%
associate-*r*8.5%
Simplified8.5%
unpow28.5%
associate-*r*8.5%
associate-*l*8.5%
*-commutative8.5%
associate-*l*8.5%
pow28.5%
metadata-eval8.5%
associate-*l*8.5%
metadata-eval8.5%
pow28.5%
Applied egg-rr8.5%
Taylor expanded in a around inf 94.6%
*-commutative94.6%
metadata-eval94.6%
pow-plus94.6%
distribute-lft-out94.6%
Simplified94.6%
if -0.0189999999999999995 < a < 5.10000000000000009e54Initial program 99.9%
sub-neg99.9%
fma-def99.9%
fma-def99.9%
+-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in a around 0 84.7%
associate-+r+84.7%
associate-*r*84.7%
distribute-rgt-out95.7%
metadata-eval95.7%
distribute-lft-in95.7%
unpow295.7%
distribute-rgt-in95.7%
metadata-eval95.7%
Simplified95.7%
Taylor expanded in a around 0 95.7%
unpow295.7%
Simplified95.7%
Taylor expanded in b around 0 95.7%
unpow295.7%
metadata-eval95.7%
pow-sqr95.7%
unpow295.7%
unpow295.7%
distribute-rgt-in95.7%
associate-*l*95.7%
+-commutative95.7%
fma-def95.7%
Simplified95.7%
if 5.10000000000000009e54 < a Initial program 22.2%
sub-neg22.2%
fma-def22.2%
fma-def25.9%
+-commutative25.9%
metadata-eval25.9%
Simplified25.9%
Taylor expanded in a around inf 100.0%
Final simplification96.4%
(FPCore (a b)
:precision binary64
(if (<= a -0.019)
(+ -1.0 (* (pow a 3.0) (+ a -4.0)))
(if (<= a 1.8e+54)
(+ -1.0 (* (* b b) (+ (* b b) 12.0)))
(+ -1.0 (pow a 4.0)))))
double code(double a, double b) {
double tmp;
if (a <= -0.019) {
tmp = -1.0 + (pow(a, 3.0) * (a + -4.0));
} else if (a <= 1.8e+54) {
tmp = -1.0 + ((b * b) * ((b * b) + 12.0));
} else {
tmp = -1.0 + 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 <= (-0.019d0)) then
tmp = (-1.0d0) + ((a ** 3.0d0) * (a + (-4.0d0)))
else if (a <= 1.8d+54) then
tmp = (-1.0d0) + ((b * b) * ((b * b) + 12.0d0))
else
tmp = (-1.0d0) + (a ** 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -0.019) {
tmp = -1.0 + (Math.pow(a, 3.0) * (a + -4.0));
} else if (a <= 1.8e+54) {
tmp = -1.0 + ((b * b) * ((b * b) + 12.0));
} else {
tmp = -1.0 + Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -0.019: tmp = -1.0 + (math.pow(a, 3.0) * (a + -4.0)) elif a <= 1.8e+54: tmp = -1.0 + ((b * b) * ((b * b) + 12.0)) else: tmp = -1.0 + math.pow(a, 4.0) return tmp
function code(a, b) tmp = 0.0 if (a <= -0.019) tmp = Float64(-1.0 + Float64((a ^ 3.0) * Float64(a + -4.0))); elseif (a <= 1.8e+54) tmp = Float64(-1.0 + Float64(Float64(b * b) * Float64(Float64(b * b) + 12.0))); else tmp = Float64(-1.0 + (a ^ 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -0.019) tmp = -1.0 + ((a ^ 3.0) * (a + -4.0)); elseif (a <= 1.8e+54) tmp = -1.0 + ((b * b) * ((b * b) + 12.0)); else tmp = -1.0 + (a ^ 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -0.019], N[(-1.0 + N[(N[Power[a, 3.0], $MachinePrecision] * N[(a + -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.8e+54], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.019:\\
\;\;\;\;-1 + {a}^{3} \cdot \left(a + -4\right)\\
\mathbf{elif}\;a \leq 1.8 \cdot 10^{+54}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot \left(b \cdot b + 12\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + {a}^{4}\\
\end{array}
\end{array}
if a < -0.0189999999999999995Initial program 64.5%
sub-neg64.5%
fma-def64.5%
fma-def64.5%
+-commutative64.5%
metadata-eval64.5%
Simplified64.5%
Taylor expanded in b around 0 96.1%
associate-*r*96.1%
unpow296.1%
Simplified96.1%
flip-+8.6%
pow-prod-up8.5%
metadata-eval8.5%
pow28.5%
*-commutative8.5%
*-commutative8.5%
Applied egg-rr8.5%
associate-*r*8.5%
associate-*r*8.5%
Simplified8.5%
unpow28.5%
associate-*r*8.5%
associate-*l*8.5%
*-commutative8.5%
associate-*l*8.5%
pow28.5%
metadata-eval8.5%
associate-*l*8.5%
metadata-eval8.5%
pow28.5%
Applied egg-rr8.5%
Taylor expanded in a around inf 94.6%
*-commutative94.6%
metadata-eval94.6%
pow-plus94.6%
distribute-lft-out94.6%
Simplified94.6%
if -0.0189999999999999995 < a < 1.8000000000000001e54Initial program 99.9%
sub-neg99.9%
fma-def99.9%
fma-def99.9%
+-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in a around 0 84.7%
associate-+r+84.7%
associate-*r*84.7%
distribute-rgt-out95.7%
metadata-eval95.7%
distribute-lft-in95.7%
unpow295.7%
distribute-rgt-in95.7%
metadata-eval95.7%
Simplified95.7%
Taylor expanded in a around 0 95.7%
unpow295.7%
Simplified95.7%
+-commutative95.7%
metadata-eval95.7%
pow-sqr95.7%
pow-prod-down95.7%
pow295.7%
distribute-rgt-out95.7%
Applied egg-rr95.7%
if 1.8000000000000001e54 < a Initial program 22.2%
sub-neg22.2%
fma-def22.2%
fma-def25.9%
+-commutative25.9%
metadata-eval25.9%
Simplified25.9%
Taylor expanded in a around inf 100.0%
Final simplification96.4%
(FPCore (a b) :precision binary64 (if (or (<= a -0.019) (not (<= a 3.95e+62))) (+ -1.0 (pow a 4.0)) (+ -1.0 (* (* b b) (+ (* b b) 12.0)))))
double code(double a, double b) {
double tmp;
if ((a <= -0.019) || !(a <= 3.95e+62)) {
tmp = -1.0 + pow(a, 4.0);
} else {
tmp = -1.0 + ((b * b) * ((b * b) + 12.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.019d0)) .or. (.not. (a <= 3.95d+62))) then
tmp = (-1.0d0) + (a ** 4.0d0)
else
tmp = (-1.0d0) + ((b * b) * ((b * b) + 12.0d0))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -0.019) || !(a <= 3.95e+62)) {
tmp = -1.0 + Math.pow(a, 4.0);
} else {
tmp = -1.0 + ((b * b) * ((b * b) + 12.0));
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -0.019) or not (a <= 3.95e+62): tmp = -1.0 + math.pow(a, 4.0) else: tmp = -1.0 + ((b * b) * ((b * b) + 12.0)) return tmp
function code(a, b) tmp = 0.0 if ((a <= -0.019) || !(a <= 3.95e+62)) tmp = Float64(-1.0 + (a ^ 4.0)); else tmp = Float64(-1.0 + Float64(Float64(b * b) * Float64(Float64(b * b) + 12.0))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -0.019) || ~((a <= 3.95e+62))) tmp = -1.0 + (a ^ 4.0); else tmp = -1.0 + ((b * b) * ((b * b) + 12.0)); end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -0.019], N[Not[LessEqual[a, 3.95e+62]], $MachinePrecision]], N[(-1.0 + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.019 \lor \neg \left(a \leq 3.95 \cdot 10^{+62}\right):\\
\;\;\;\;-1 + {a}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot \left(b \cdot b + 12\right)\\
\end{array}
\end{array}
if a < -0.0189999999999999995 or 3.9499999999999998e62 < a Initial program 42.1%
sub-neg42.1%
fma-def42.1%
fma-def44.1%
+-commutative44.1%
metadata-eval44.1%
Simplified44.1%
Taylor expanded in a around inf 97.3%
if -0.0189999999999999995 < a < 3.9499999999999998e62Initial program 99.9%
sub-neg99.9%
fma-def99.9%
fma-def99.9%
+-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in a around 0 84.7%
associate-+r+84.7%
associate-*r*84.7%
distribute-rgt-out95.7%
metadata-eval95.7%
distribute-lft-in95.7%
unpow295.7%
distribute-rgt-in95.7%
metadata-eval95.7%
Simplified95.7%
Taylor expanded in a around 0 95.7%
unpow295.7%
Simplified95.7%
+-commutative95.7%
metadata-eval95.7%
pow-sqr95.7%
pow-prod-down95.7%
pow295.7%
distribute-rgt-out95.7%
Applied egg-rr95.7%
Final simplification96.3%
(FPCore (a b)
:precision binary64
(if (<= a -7e+57)
(+ -1.0 (* 4.0 (* a (* a (- 1.0 a)))))
(if (<= a 5.8e+153)
(+ -1.0 (* (* b b) (+ (* b b) 12.0)))
(+ -1.0 (* a (* a 4.0))))))
double code(double a, double b) {
double tmp;
if (a <= -7e+57) {
tmp = -1.0 + (4.0 * (a * (a * (1.0 - a))));
} else if (a <= 5.8e+153) {
tmp = -1.0 + ((b * b) * ((b * b) + 12.0));
} else {
tmp = -1.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 <= (-7d+57)) then
tmp = (-1.0d0) + (4.0d0 * (a * (a * (1.0d0 - a))))
else if (a <= 5.8d+153) then
tmp = (-1.0d0) + ((b * b) * ((b * b) + 12.0d0))
else
tmp = (-1.0d0) + (a * (a * 4.0d0))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -7e+57) {
tmp = -1.0 + (4.0 * (a * (a * (1.0 - a))));
} else if (a <= 5.8e+153) {
tmp = -1.0 + ((b * b) * ((b * b) + 12.0));
} else {
tmp = -1.0 + (a * (a * 4.0));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -7e+57: tmp = -1.0 + (4.0 * (a * (a * (1.0 - a)))) elif a <= 5.8e+153: tmp = -1.0 + ((b * b) * ((b * b) + 12.0)) else: tmp = -1.0 + (a * (a * 4.0)) return tmp
function code(a, b) tmp = 0.0 if (a <= -7e+57) tmp = Float64(-1.0 + Float64(4.0 * Float64(a * Float64(a * Float64(1.0 - a))))); elseif (a <= 5.8e+153) tmp = Float64(-1.0 + Float64(Float64(b * b) * Float64(Float64(b * b) + 12.0))); else tmp = Float64(-1.0 + Float64(a * Float64(a * 4.0))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -7e+57) tmp = -1.0 + (4.0 * (a * (a * (1.0 - a)))); elseif (a <= 5.8e+153) tmp = -1.0 + ((b * b) * ((b * b) + 12.0)); else tmp = -1.0 + (a * (a * 4.0)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -7e+57], N[(-1.0 + N[(4.0 * N[(a * N[(a * N[(1.0 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.8e+153], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7 \cdot 10^{+57}:\\
\;\;\;\;-1 + 4 \cdot \left(a \cdot \left(a \cdot \left(1 - a\right)\right)\right)\\
\mathbf{elif}\;a \leq 5.8 \cdot 10^{+153}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot \left(b \cdot b + 12\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + a \cdot \left(a \cdot 4\right)\\
\end{array}
\end{array}
if a < -6.9999999999999995e57Initial program 60.9%
sub-neg60.9%
fma-def60.9%
fma-def60.9%
+-commutative60.9%
metadata-eval60.9%
Simplified60.9%
Taylor expanded in b around 0 100.0%
associate-*r*100.0%
unpow2100.0%
Simplified100.0%
flip-+0.0%
pow-prod-up0.0%
metadata-eval0.0%
pow20.0%
*-commutative0.0%
*-commutative0.0%
Applied egg-rr0.0%
associate-*r*0.0%
associate-*r*0.0%
Simplified0.0%
unpow20.0%
associate-*r*0.0%
associate-*l*0.0%
*-commutative0.0%
associate-*l*0.0%
pow20.0%
metadata-eval0.0%
associate-*l*0.0%
metadata-eval0.0%
pow20.0%
Applied egg-rr0.0%
Taylor expanded in a around 0 86.5%
*-commutative86.5%
unpow286.5%
associate-*r*86.5%
*-commutative86.5%
cube-mult86.5%
unpow286.5%
associate-*l*86.5%
metadata-eval86.5%
distribute-rgt-neg-in86.5%
unpow286.5%
associate-*r*86.5%
distribute-lft-out86.5%
*-lft-identity86.5%
distribute-lft-neg-in86.5%
distribute-rgt-in86.5%
sub-neg86.5%
associate-*l*86.5%
*-commutative86.5%
associate-*l*86.5%
*-commutative86.5%
associate-*r*86.5%
Simplified86.5%
if -6.9999999999999995e57 < a < 5.80000000000000004e153Initial program 94.4%
sub-neg94.4%
fma-def94.4%
fma-def95.5%
+-commutative95.5%
metadata-eval95.5%
Simplified95.5%
Taylor expanded in a around 0 76.0%
associate-+r+76.0%
associate-*r*76.0%
distribute-rgt-out85.3%
metadata-eval85.3%
distribute-lft-in85.3%
unpow285.3%
distribute-rgt-in85.3%
metadata-eval85.3%
Simplified85.3%
Taylor expanded in a around 0 85.8%
unpow285.8%
Simplified85.8%
+-commutative85.8%
metadata-eval85.8%
pow-sqr85.8%
pow-prod-down85.8%
pow285.8%
distribute-rgt-out85.8%
Applied egg-rr85.8%
if 5.80000000000000004e153 < a Initial program 0.0%
sub-neg0.0%
fma-def0.0%
fma-def0.0%
+-commutative0.0%
metadata-eval0.0%
Simplified0.0%
Taylor expanded in b around 0 0.0%
associate-*r*0.0%
unpow20.0%
Simplified0.0%
Taylor expanded in a around 0 100.0%
unpow2100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification87.7%
(FPCore (a b) :precision binary64 (if (<= a -9.5e+40) (+ -1.0 (* 4.0 (* a (* a (- 1.0 a))))) (if (<= a 6.5e+153) (+ -1.0 (* (* b b) 12.0)) (+ -1.0 (* a (* a 4.0))))))
double code(double a, double b) {
double tmp;
if (a <= -9.5e+40) {
tmp = -1.0 + (4.0 * (a * (a * (1.0 - a))));
} else if (a <= 6.5e+153) {
tmp = -1.0 + ((b * b) * 12.0);
} else {
tmp = -1.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 <= (-9.5d+40)) then
tmp = (-1.0d0) + (4.0d0 * (a * (a * (1.0d0 - a))))
else if (a <= 6.5d+153) then
tmp = (-1.0d0) + ((b * b) * 12.0d0)
else
tmp = (-1.0d0) + (a * (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 = -1.0 + (4.0 * (a * (a * (1.0 - a))));
} else if (a <= 6.5e+153) {
tmp = -1.0 + ((b * b) * 12.0);
} else {
tmp = -1.0 + (a * (a * 4.0));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -9.5e+40: tmp = -1.0 + (4.0 * (a * (a * (1.0 - a)))) elif a <= 6.5e+153: tmp = -1.0 + ((b * b) * 12.0) else: tmp = -1.0 + (a * (a * 4.0)) return tmp
function code(a, b) tmp = 0.0 if (a <= -9.5e+40) tmp = Float64(-1.0 + Float64(4.0 * Float64(a * Float64(a * Float64(1.0 - a))))); elseif (a <= 6.5e+153) tmp = Float64(-1.0 + Float64(Float64(b * b) * 12.0)); else tmp = Float64(-1.0 + Float64(a * Float64(a * 4.0))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -9.5e+40) tmp = -1.0 + (4.0 * (a * (a * (1.0 - a)))); elseif (a <= 6.5e+153) tmp = -1.0 + ((b * b) * 12.0); else tmp = -1.0 + (a * (a * 4.0)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -9.5e+40], N[(-1.0 + N[(4.0 * N[(a * N[(a * N[(1.0 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 6.5e+153], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.5 \cdot 10^{+40}:\\
\;\;\;\;-1 + 4 \cdot \left(a \cdot \left(a \cdot \left(1 - a\right)\right)\right)\\
\mathbf{elif}\;a \leq 6.5 \cdot 10^{+153}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot 12\\
\mathbf{else}:\\
\;\;\;\;-1 + a \cdot \left(a \cdot 4\right)\\
\end{array}
\end{array}
if a < -9.5000000000000003e40Initial program 62.7%
sub-neg62.7%
fma-def62.7%
fma-def62.7%
+-commutative62.7%
metadata-eval62.7%
Simplified62.7%
Taylor expanded in b around 0 97.8%
associate-*r*97.8%
unpow297.8%
Simplified97.8%
flip-+0.1%
pow-prod-up0.1%
metadata-eval0.1%
pow20.1%
*-commutative0.1%
*-commutative0.1%
Applied egg-rr0.1%
associate-*r*0.1%
associate-*r*0.1%
Simplified0.1%
unpow20.1%
associate-*r*0.1%
associate-*l*0.1%
*-commutative0.1%
associate-*l*0.1%
pow20.1%
metadata-eval0.1%
associate-*l*0.1%
metadata-eval0.1%
pow20.1%
Applied egg-rr0.1%
Taylor expanded in a around 0 82.7%
*-commutative82.7%
unpow282.7%
associate-*r*82.7%
*-commutative82.7%
cube-mult82.7%
unpow282.7%
associate-*l*82.7%
metadata-eval82.7%
distribute-rgt-neg-in82.7%
unpow282.7%
associate-*r*82.7%
distribute-lft-out82.7%
*-lft-identity82.7%
distribute-lft-neg-in82.7%
distribute-rgt-in82.7%
sub-neg82.7%
associate-*l*82.7%
*-commutative82.7%
associate-*l*82.7%
*-commutative82.7%
associate-*r*82.7%
Simplified82.7%
if -9.5000000000000003e40 < a < 6.49999999999999972e153Initial program 94.3%
sub-neg94.3%
fma-def94.3%
fma-def95.4%
+-commutative95.4%
metadata-eval95.4%
Simplified95.4%
Taylor expanded in a around 0 76.2%
associate-+r+76.2%
associate-*r*76.2%
distribute-rgt-out85.7%
metadata-eval85.7%
distribute-lft-in85.7%
unpow285.7%
distribute-rgt-in85.7%
metadata-eval85.7%
Simplified85.7%
Taylor expanded in a around 0 86.2%
unpow286.2%
Simplified86.2%
Taylor expanded in b around 0 86.2%
unpow286.2%
metadata-eval86.2%
pow-sqr86.1%
unpow286.1%
unpow286.1%
distribute-rgt-in86.1%
associate-*l*86.1%
+-commutative86.1%
fma-def86.1%
Simplified86.1%
Taylor expanded in b around 0 60.8%
unpow260.8%
Simplified60.8%
if 6.49999999999999972e153 < a Initial program 0.0%
sub-neg0.0%
fma-def0.0%
fma-def0.0%
+-commutative0.0%
metadata-eval0.0%
Simplified0.0%
Taylor expanded in b around 0 0.0%
associate-*r*0.0%
unpow20.0%
Simplified0.0%
Taylor expanded in a around 0 100.0%
unpow2100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification69.5%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e+295) (+ -1.0 (* a (* a 4.0))) (+ -1.0 (* (* b b) 12.0))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+295) {
tmp = -1.0 + (a * (a * 4.0));
} else {
tmp = -1.0 + ((b * b) * 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+295) then
tmp = (-1.0d0) + (a * (a * 4.0d0))
else
tmp = (-1.0d0) + ((b * b) * 12.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+295) {
tmp = -1.0 + (a * (a * 4.0));
} else {
tmp = -1.0 + ((b * b) * 12.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e+295: tmp = -1.0 + (a * (a * 4.0)) else: tmp = -1.0 + ((b * b) * 12.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e+295) tmp = Float64(-1.0 + Float64(a * Float64(a * 4.0))); else tmp = Float64(-1.0 + Float64(Float64(b * b) * 12.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e+295) tmp = -1.0 + (a * (a * 4.0)); else tmp = -1.0 + ((b * b) * 12.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e+295], N[(-1.0 + N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{+295}:\\
\;\;\;\;-1 + a \cdot \left(a \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot 12\\
\end{array}
\end{array}
if (*.f64 b b) < 2e295Initial program 80.7%
sub-neg80.7%
fma-def80.7%
fma-def80.7%
+-commutative80.7%
metadata-eval80.7%
Simplified80.7%
Taylor expanded in b around 0 61.2%
associate-*r*61.2%
unpow261.2%
Simplified61.2%
Taylor expanded in a around 0 58.3%
unpow258.3%
associate-*r*58.3%
Simplified58.3%
if 2e295 < (*.f64 b b) Initial program 62.3%
sub-neg62.3%
fma-def62.3%
fma-def66.0%
+-commutative66.0%
metadata-eval66.0%
Simplified66.0%
Taylor expanded in a around 0 50.9%
associate-+r+50.9%
associate-*r*50.9%
distribute-rgt-out83.0%
metadata-eval83.0%
distribute-lft-in83.0%
unpow283.0%
distribute-rgt-in83.0%
metadata-eval83.0%
Simplified83.0%
Taylor expanded in a around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in b around 0 100.0%
unpow2100.0%
metadata-eval100.0%
pow-sqr100.0%
unpow2100.0%
unpow2100.0%
distribute-rgt-in100.0%
associate-*l*100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in b around 0 100.0%
unpow2100.0%
Simplified100.0%
Final simplification66.9%
(FPCore (a b) :precision binary64 (+ -1.0 (* (* b b) 12.0)))
double code(double a, double b) {
return -1.0 + ((b * b) * 12.0);
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (-1.0d0) + ((b * b) * 12.0d0)
end function
public static double code(double a, double b) {
return -1.0 + ((b * b) * 12.0);
}
def code(a, b): return -1.0 + ((b * b) * 12.0)
function code(a, b) return Float64(-1.0 + Float64(Float64(b * b) * 12.0)) end
function tmp = code(a, b) tmp = -1.0 + ((b * b) * 12.0); end
code[a_, b_] := N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1 + \left(b \cdot b\right) \cdot 12
\end{array}
Initial program 76.9%
sub-neg76.9%
fma-def76.9%
fma-def77.6%
+-commutative77.6%
metadata-eval77.6%
Simplified77.6%
Taylor expanded in a around 0 60.9%
associate-+r+60.9%
associate-*r*60.9%
distribute-rgt-out67.5%
metadata-eval67.5%
distribute-lft-in67.5%
unpow267.5%
distribute-rgt-in67.5%
metadata-eval67.5%
Simplified67.5%
Taylor expanded in a around 0 73.0%
unpow273.0%
Simplified73.0%
Taylor expanded in b around 0 73.0%
unpow273.0%
metadata-eval73.0%
pow-sqr73.0%
unpow273.0%
unpow273.0%
distribute-rgt-in73.0%
associate-*l*73.0%
+-commutative73.0%
fma-def73.0%
Simplified73.0%
Taylor expanded in b around 0 50.0%
unpow250.0%
Simplified50.0%
Final simplification50.0%
(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.9%
sub-neg76.9%
fma-def76.9%
fma-def77.6%
+-commutative77.6%
metadata-eval77.6%
Simplified77.6%
Taylor expanded in a around inf 66.9%
Taylor expanded in a around 0 27.4%
Final simplification27.4%
herbie shell --seed 2023261
(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))