
(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 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) (- 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 (let* ((t_0 (+ (* a a) (* b b)))) (+ (* t_0 t_0) (+ (* (* b b) 4.0) -1.0))))
double code(double a, double b) {
double t_0 = (a * a) + (b * b);
return (t_0 * t_0) + (((b * b) * 4.0) + -1.0);
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
t_0 = (a * a) + (b * b)
code = (t_0 * t_0) + (((b * b) * 4.0d0) + (-1.0d0))
end function
public static double code(double a, double b) {
double t_0 = (a * a) + (b * b);
return (t_0 * t_0) + (((b * b) * 4.0) + -1.0);
}
def code(a, b): t_0 = (a * a) + (b * b) return (t_0 * t_0) + (((b * b) * 4.0) + -1.0)
function code(a, b) t_0 = Float64(Float64(a * a) + Float64(b * b)) return Float64(Float64(t_0 * t_0) + Float64(Float64(Float64(b * b) * 4.0) + -1.0)) end
function tmp = code(a, b) t_0 = (a * a) + (b * b); tmp = (t_0 * t_0) + (((b * b) * 4.0) + -1.0); end
code[a_, b_] := Block[{t$95$0 = N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, N[(N[(t$95$0 * t$95$0), $MachinePrecision] + N[(N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot a + b \cdot b\\
t\_0 \cdot t\_0 + \left(\left(b \cdot b\right) \cdot 4 + -1\right)
\end{array}
\end{array}
Initial program 74.8%
associate--l+N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
Simplified74.4%
Taylor expanded in a around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6499.0%
Simplified99.0%
Final simplification99.0%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* a (* a (* a (+ a 4.0))))))
(if (<= a -170000000000.0)
t_0
(if (<= a 42000000.0) (+ (* b (* b (+ (* b b) 4.0))) -1.0) t_0))))
double code(double a, double b) {
double t_0 = a * (a * (a * (a + 4.0)));
double tmp;
if (a <= -170000000000.0) {
tmp = t_0;
} else if (a <= 42000000.0) {
tmp = (b * (b * ((b * b) + 4.0))) + -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 = a * (a * (a * (a + 4.0d0)))
if (a <= (-170000000000.0d0)) then
tmp = t_0
else if (a <= 42000000.0d0) then
tmp = (b * (b * ((b * b) + 4.0d0))) + (-1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = a * (a * (a * (a + 4.0)));
double tmp;
if (a <= -170000000000.0) {
tmp = t_0;
} else if (a <= 42000000.0) {
tmp = (b * (b * ((b * b) + 4.0))) + -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b): t_0 = a * (a * (a * (a + 4.0))) tmp = 0 if a <= -170000000000.0: tmp = t_0 elif a <= 42000000.0: tmp = (b * (b * ((b * b) + 4.0))) + -1.0 else: tmp = t_0 return tmp
function code(a, b) t_0 = Float64(a * Float64(a * Float64(a * Float64(a + 4.0)))) tmp = 0.0 if (a <= -170000000000.0) tmp = t_0; elseif (a <= 42000000.0) tmp = Float64(Float64(b * Float64(b * Float64(Float64(b * b) + 4.0))) + -1.0); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b) t_0 = a * (a * (a * (a + 4.0))); tmp = 0.0; if (a <= -170000000000.0) tmp = t_0; elseif (a <= 42000000.0) tmp = (b * (b * ((b * b) + 4.0))) + -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(a * N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -170000000000.0], t$95$0, If[LessEqual[a, 42000000.0], N[(N[(b * N[(b * N[(N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(a \cdot \left(a \cdot \left(a + 4\right)\right)\right)\\
\mathbf{if}\;a \leq -170000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 42000000:\\
\;\;\;\;b \cdot \left(b \cdot \left(b \cdot b + 4\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -1.7e11 or 4.2e7 < a Initial program 44.2%
Taylor expanded in b around 0
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
metadata-evalN/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6494.2%
Simplified94.2%
Taylor expanded in a around 0
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f6494.2%
Simplified94.2%
Taylor expanded in a around inf
metadata-evalN/A
pow-plusN/A
associate-*l*N/A
unpow3N/A
unpow2N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f6494.2%
Simplified94.2%
if -1.7e11 < a < 4.2e7Initial program 99.8%
Taylor expanded in a around 0
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6498.8%
Simplified98.8%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6498.9%
Applied egg-rr98.9%
Final simplification96.8%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* a (* a (* a (+ a 4.0))))))
(if (<= a -105000000000.0)
t_0
(if (<= a 42000000.0) (+ (* (* b b) (+ (* b b) 4.0)) -1.0) t_0))))
double code(double a, double b) {
double t_0 = a * (a * (a * (a + 4.0)));
double tmp;
if (a <= -105000000000.0) {
tmp = t_0;
} else if (a <= 42000000.0) {
tmp = ((b * b) * ((b * b) + 4.0)) + -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 = a * (a * (a * (a + 4.0d0)))
if (a <= (-105000000000.0d0)) then
tmp = t_0
else if (a <= 42000000.0d0) then
tmp = ((b * b) * ((b * b) + 4.0d0)) + (-1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = a * (a * (a * (a + 4.0)));
double tmp;
if (a <= -105000000000.0) {
tmp = t_0;
} else if (a <= 42000000.0) {
tmp = ((b * b) * ((b * b) + 4.0)) + -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b): t_0 = a * (a * (a * (a + 4.0))) tmp = 0 if a <= -105000000000.0: tmp = t_0 elif a <= 42000000.0: tmp = ((b * b) * ((b * b) + 4.0)) + -1.0 else: tmp = t_0 return tmp
function code(a, b) t_0 = Float64(a * Float64(a * Float64(a * Float64(a + 4.0)))) tmp = 0.0 if (a <= -105000000000.0) tmp = t_0; elseif (a <= 42000000.0) tmp = Float64(Float64(Float64(b * b) * Float64(Float64(b * b) + 4.0)) + -1.0); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b) t_0 = a * (a * (a * (a + 4.0))); tmp = 0.0; if (a <= -105000000000.0) tmp = t_0; elseif (a <= 42000000.0) tmp = ((b * b) * ((b * b) + 4.0)) + -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(a * N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -105000000000.0], t$95$0, If[LessEqual[a, 42000000.0], N[(N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(a \cdot \left(a \cdot \left(a + 4\right)\right)\right)\\
\mathbf{if}\;a \leq -105000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 42000000:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(b \cdot b + 4\right) + -1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -1.05e11 or 4.2e7 < a Initial program 44.2%
Taylor expanded in b around 0
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
metadata-evalN/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6494.2%
Simplified94.2%
Taylor expanded in a around 0
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f6494.2%
Simplified94.2%
Taylor expanded in a around inf
metadata-evalN/A
pow-plusN/A
associate-*l*N/A
unpow3N/A
unpow2N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f6494.2%
Simplified94.2%
if -1.05e11 < a < 4.2e7Initial program 99.8%
Taylor expanded in a around 0
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6498.8%
Simplified98.8%
Final simplification96.7%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e-213) -1.0 (if (<= (* b b) 0.5) (* a (* a (* a a))) (* b (* b (* b b))))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e-213) {
tmp = -1.0;
} else if ((b * b) <= 0.5) {
tmp = a * (a * (a * a));
} else {
tmp = b * (b * (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 * b) <= 2d-213) then
tmp = -1.0d0
else if ((b * b) <= 0.5d0) then
tmp = a * (a * (a * a))
else
tmp = b * (b * (b * b))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e-213) {
tmp = -1.0;
} else if ((b * b) <= 0.5) {
tmp = a * (a * (a * a));
} else {
tmp = b * (b * (b * b));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e-213: tmp = -1.0 elif (b * b) <= 0.5: tmp = a * (a * (a * a)) else: tmp = b * (b * (b * b)) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e-213) tmp = -1.0; elseif (Float64(b * b) <= 0.5) tmp = Float64(a * Float64(a * Float64(a * a))); else tmp = Float64(b * Float64(b * Float64(b * b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e-213) tmp = -1.0; elseif ((b * b) <= 0.5) tmp = a * (a * (a * a)); else tmp = b * (b * (b * b)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e-213], -1.0, If[LessEqual[N[(b * b), $MachinePrecision], 0.5], N[(a * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{-213}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \cdot b \leq 0.5:\\
\;\;\;\;a \cdot \left(a \cdot \left(a \cdot a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(b \cdot \left(b \cdot b\right)\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 1.9999999999999999e-213Initial program 84.6%
Taylor expanded in a around 0
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6458.0%
Simplified58.0%
Taylor expanded in b around 0
Simplified58.0%
if 1.9999999999999999e-213 < (*.f64 b b) < 0.5Initial program 82.4%
associate--l+N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
Simplified82.3%
Taylor expanded in a around inf
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
unpow2N/A
cube-multN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6460.8%
Simplified60.8%
if 0.5 < (*.f64 b b) Initial program 65.3%
associate--l+N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
Simplified65.3%
Taylor expanded in b around inf
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6490.2%
Simplified90.2%
(FPCore (a b) :precision binary64 (if (<= (* b b) 0.5) (+ (* a (* a (+ 4.0 (* a (+ a 4.0))))) -1.0) (* (* b b) (+ (* b b) (* (* a a) 2.0)))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 0.5) {
tmp = (a * (a * (4.0 + (a * (a + 4.0))))) + -1.0;
} else {
tmp = (b * b) * ((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) <= 0.5d0) then
tmp = (a * (a * (4.0d0 + (a * (a + 4.0d0))))) + (-1.0d0)
else
tmp = (b * b) * ((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) <= 0.5) {
tmp = (a * (a * (4.0 + (a * (a + 4.0))))) + -1.0;
} else {
tmp = (b * b) * ((b * b) + ((a * a) * 2.0));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 0.5: tmp = (a * (a * (4.0 + (a * (a + 4.0))))) + -1.0 else: tmp = (b * b) * ((b * b) + ((a * a) * 2.0)) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 0.5) tmp = Float64(Float64(a * Float64(a * Float64(4.0 + Float64(a * Float64(a + 4.0))))) + -1.0); else tmp = Float64(Float64(b * b) * 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) <= 0.5) tmp = (a * (a * (4.0 + (a * (a + 4.0))))) + -1.0; else tmp = (b * b) * ((b * b) + ((a * a) * 2.0)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 0.5], N[(N[(a * N[(a * N[(4.0 + N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + N[(N[(a * a), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 0.5:\\
\;\;\;\;a \cdot \left(a \cdot \left(4 + a \cdot \left(a + 4\right)\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(b \cdot b + \left(a \cdot a\right) \cdot 2\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 0.5Initial program 83.8%
Taylor expanded in b around 0
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
metadata-evalN/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6499.1%
Simplified99.1%
Taylor expanded in a around 0
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f6499.1%
Simplified99.1%
if 0.5 < (*.f64 b b) Initial program 65.3%
associate--l+N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
Simplified65.3%
Taylor expanded in a around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6499.7%
Simplified99.7%
Taylor expanded in b around 0
Simplified99.7%
Taylor expanded in a around 0
+-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6491.0%
Simplified91.0%
Taylor expanded in b around inf
distribute-rgt-inN/A
*-lft-identityN/A
metadata-evalN/A
pow-sqrN/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
*-lft-identityN/A
associate-*l/N/A
metadata-evalN/A
pow-sqrN/A
associate-*r*N/A
lft-mult-inverseN/A
*-lft-identityN/A
distribute-rgt-inN/A
+-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
Simplified97.2%
Final simplification98.2%
(FPCore (a b) :precision binary64 (if (<= (* b b) 0.5) (+ (* a (* a (* a a))) -1.0) (* (* b b) (+ (* b b) (* (* a a) 2.0)))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 0.5) {
tmp = (a * (a * (a * a))) + -1.0;
} else {
tmp = (b * b) * ((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) <= 0.5d0) then
tmp = (a * (a * (a * a))) + (-1.0d0)
else
tmp = (b * b) * ((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) <= 0.5) {
tmp = (a * (a * (a * a))) + -1.0;
} else {
tmp = (b * b) * ((b * b) + ((a * a) * 2.0));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 0.5: tmp = (a * (a * (a * a))) + -1.0 else: tmp = (b * b) * ((b * b) + ((a * a) * 2.0)) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 0.5) tmp = Float64(Float64(a * Float64(a * Float64(a * a))) + -1.0); else tmp = Float64(Float64(b * b) * 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) <= 0.5) tmp = (a * (a * (a * a))) + -1.0; else tmp = (b * b) * ((b * b) + ((a * a) * 2.0)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 0.5], N[(N[(a * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + N[(N[(a * a), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 0.5:\\
\;\;\;\;a \cdot \left(a \cdot \left(a \cdot a\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(b \cdot b + \left(a \cdot a\right) \cdot 2\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 0.5Initial program 83.8%
Taylor expanded in a around inf
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
unpow2N/A
cube-multN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6497.5%
Simplified97.5%
if 0.5 < (*.f64 b b) Initial program 65.3%
associate--l+N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
Simplified65.3%
Taylor expanded in a around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6499.7%
Simplified99.7%
Taylor expanded in b around 0
Simplified99.7%
Taylor expanded in a around 0
+-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6491.0%
Simplified91.0%
Taylor expanded in b around inf
distribute-rgt-inN/A
*-lft-identityN/A
metadata-evalN/A
pow-sqrN/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
*-lft-identityN/A
associate-*l/N/A
metadata-evalN/A
pow-sqrN/A
associate-*r*N/A
lft-mult-inverseN/A
*-lft-identityN/A
distribute-rgt-inN/A
+-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
Simplified97.2%
Final simplification97.3%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* a (* a (* a (+ a 4.0))))))
(if (<= a -80000000000.0)
t_0
(if (<= a 180000000000.0) (+ (* b (* b (* b b))) -1.0) t_0))))
double code(double a, double b) {
double t_0 = a * (a * (a * (a + 4.0)));
double tmp;
if (a <= -80000000000.0) {
tmp = t_0;
} else if (a <= 180000000000.0) {
tmp = (b * (b * (b * b))) + -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 = a * (a * (a * (a + 4.0d0)))
if (a <= (-80000000000.0d0)) then
tmp = t_0
else if (a <= 180000000000.0d0) then
tmp = (b * (b * (b * b))) + (-1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = a * (a * (a * (a + 4.0)));
double tmp;
if (a <= -80000000000.0) {
tmp = t_0;
} else if (a <= 180000000000.0) {
tmp = (b * (b * (b * b))) + -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b): t_0 = a * (a * (a * (a + 4.0))) tmp = 0 if a <= -80000000000.0: tmp = t_0 elif a <= 180000000000.0: tmp = (b * (b * (b * b))) + -1.0 else: tmp = t_0 return tmp
function code(a, b) t_0 = Float64(a * Float64(a * Float64(a * Float64(a + 4.0)))) tmp = 0.0 if (a <= -80000000000.0) tmp = t_0; elseif (a <= 180000000000.0) tmp = Float64(Float64(b * Float64(b * Float64(b * b))) + -1.0); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b) t_0 = a * (a * (a * (a + 4.0))); tmp = 0.0; if (a <= -80000000000.0) tmp = t_0; elseif (a <= 180000000000.0) tmp = (b * (b * (b * b))) + -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(a * N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -80000000000.0], t$95$0, If[LessEqual[a, 180000000000.0], N[(N[(b * N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(a \cdot \left(a \cdot \left(a + 4\right)\right)\right)\\
\mathbf{if}\;a \leq -80000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 180000000000:\\
\;\;\;\;b \cdot \left(b \cdot \left(b \cdot b\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -8e10 or 1.8e11 < a Initial program 44.2%
Taylor expanded in b around 0
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
metadata-evalN/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6494.2%
Simplified94.2%
Taylor expanded in a around 0
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f6494.2%
Simplified94.2%
Taylor expanded in a around inf
metadata-evalN/A
pow-plusN/A
associate-*l*N/A
unpow3N/A
unpow2N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f6494.2%
Simplified94.2%
if -8e10 < a < 1.8e11Initial program 99.8%
Taylor expanded in b around inf
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6498.1%
Simplified98.1%
Final simplification96.3%
(FPCore (a b) :precision binary64 (let* ((t_0 (* a (* a (* a a))))) (if (<= a -4e-31) t_0 (if (<= a 0.41) -1.0 t_0))))
double code(double a, double b) {
double t_0 = a * (a * (a * a));
double tmp;
if (a <= -4e-31) {
tmp = t_0;
} else if (a <= 0.41) {
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 = a * (a * (a * a))
if (a <= (-4d-31)) then
tmp = t_0
else if (a <= 0.41d0) 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 = a * (a * (a * a));
double tmp;
if (a <= -4e-31) {
tmp = t_0;
} else if (a <= 0.41) {
tmp = -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b): t_0 = a * (a * (a * a)) tmp = 0 if a <= -4e-31: tmp = t_0 elif a <= 0.41: tmp = -1.0 else: tmp = t_0 return tmp
function code(a, b) t_0 = Float64(a * Float64(a * Float64(a * a))) tmp = 0.0 if (a <= -4e-31) tmp = t_0; elseif (a <= 0.41) tmp = -1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(a, b) t_0 = a * (a * (a * a)); tmp = 0.0; if (a <= -4e-31) tmp = t_0; elseif (a <= 0.41) tmp = -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -4e-31], t$95$0, If[LessEqual[a, 0.41], -1.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(a \cdot \left(a \cdot a\right)\right)\\
\mathbf{if}\;a \leq -4 \cdot 10^{-31}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 0.41:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -4e-31 or 0.409999999999999976 < a Initial program 47.4%
associate--l+N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
Simplified46.5%
Taylor expanded in a around inf
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
unpow2N/A
cube-multN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6488.4%
Simplified88.4%
if -4e-31 < a < 0.409999999999999976Initial program 99.8%
Taylor expanded in a around 0
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6499.4%
Simplified99.4%
Taylor expanded in b around 0
Simplified49.3%
(FPCore (a b) :precision binary64 (let* ((t_0 (+ (* a a) (* b b)))) (+ (* t_0 t_0) -1.0)))
double code(double a, double b) {
double t_0 = (a * a) + (b * b);
return (t_0 * t_0) + -1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
t_0 = (a * a) + (b * b)
code = (t_0 * t_0) + (-1.0d0)
end function
public static double code(double a, double b) {
double t_0 = (a * a) + (b * b);
return (t_0 * t_0) + -1.0;
}
def code(a, b): t_0 = (a * a) + (b * b) return (t_0 * t_0) + -1.0
function code(a, b) t_0 = Float64(Float64(a * a) + Float64(b * b)) return Float64(Float64(t_0 * t_0) + -1.0) end
function tmp = code(a, b) t_0 = (a * a) + (b * b); tmp = (t_0 * t_0) + -1.0; end
code[a_, b_] := Block[{t$95$0 = N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, N[(N[(t$95$0 * t$95$0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot a + b \cdot b\\
t\_0 \cdot t\_0 + -1
\end{array}
\end{array}
Initial program 74.8%
associate--l+N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
Simplified74.4%
Taylor expanded in a around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6499.0%
Simplified99.0%
Taylor expanded in b around 0
Simplified98.5%
(FPCore (a b) :precision binary64 (if (<= (* b b) 0.5) (+ (* a (* a (* a a))) -1.0) (* b (* b (* b b)))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 0.5) {
tmp = (a * (a * (a * a))) + -1.0;
} else {
tmp = b * (b * (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 * b) <= 0.5d0) then
tmp = (a * (a * (a * a))) + (-1.0d0)
else
tmp = b * (b * (b * b))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 0.5) {
tmp = (a * (a * (a * a))) + -1.0;
} else {
tmp = b * (b * (b * b));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 0.5: tmp = (a * (a * (a * a))) + -1.0 else: tmp = b * (b * (b * b)) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 0.5) tmp = Float64(Float64(a * Float64(a * Float64(a * a))) + -1.0); else tmp = Float64(b * Float64(b * Float64(b * b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 0.5) tmp = (a * (a * (a * a))) + -1.0; else tmp = b * (b * (b * b)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 0.5], N[(N[(a * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(b * N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 0.5:\\
\;\;\;\;a \cdot \left(a \cdot \left(a \cdot a\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(b \cdot \left(b \cdot b\right)\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 0.5Initial program 83.8%
Taylor expanded in a around inf
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
unpow2N/A
cube-multN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6497.5%
Simplified97.5%
if 0.5 < (*.f64 b b) Initial program 65.3%
associate--l+N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
Simplified65.3%
Taylor expanded in b around inf
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6490.2%
Simplified90.2%
Final simplification93.9%
(FPCore (a b) :precision binary64 (if (<= (* b b) 0.5) (+ (* (* a a) 4.0) -1.0) (* b (* b (* b b)))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 0.5) {
tmp = ((a * a) * 4.0) + -1.0;
} else {
tmp = b * (b * (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 * b) <= 0.5d0) then
tmp = ((a * a) * 4.0d0) + (-1.0d0)
else
tmp = b * (b * (b * b))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 0.5) {
tmp = ((a * a) * 4.0) + -1.0;
} else {
tmp = b * (b * (b * b));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 0.5: tmp = ((a * a) * 4.0) + -1.0 else: tmp = b * (b * (b * b)) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 0.5) tmp = Float64(Float64(Float64(a * a) * 4.0) + -1.0); else tmp = Float64(b * Float64(b * Float64(b * b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 0.5) tmp = ((a * a) * 4.0) + -1.0; else tmp = b * (b * (b * b)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 0.5], N[(N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision] + -1.0), $MachinePrecision], N[(b * N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 0.5:\\
\;\;\;\;\left(a \cdot a\right) \cdot 4 + -1\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(b \cdot \left(b \cdot b\right)\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 0.5Initial program 83.8%
Taylor expanded in b around 0
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
metadata-evalN/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6499.1%
Simplified99.1%
Taylor expanded in a around 0
Simplified80.6%
if 0.5 < (*.f64 b b) Initial program 65.3%
associate--l+N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
Simplified65.3%
Taylor expanded in b around inf
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6490.2%
Simplified90.2%
Final simplification85.3%
(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 74.8%
Taylor expanded in a around 0
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6470.2%
Simplified70.2%
Taylor expanded in b around 0
Simplified26.2%
herbie shell --seed 2024163
(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))