
(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 13 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 (+ (* a a) (* b b)))) (+ (* t_0 t_0) (+ (* 4.0 (* b (* b 3.0))) -1.0))))
double code(double a, double b) {
double t_0 = (a * a) + (b * b);
return (t_0 * t_0) + ((4.0 * (b * (b * 3.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) + ((4.0d0 * (b * (b * 3.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) + ((4.0 * (b * (b * 3.0))) + -1.0);
}
def code(a, b): t_0 = (a * a) + (b * b) return (t_0 * t_0) + ((4.0 * (b * (b * 3.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(4.0 * Float64(b * Float64(b * 3.0))) + -1.0)) end
function tmp = code(a, b) t_0 = (a * a) + (b * b); tmp = (t_0 * t_0) + ((4.0 * (b * (b * 3.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[(4.0 * N[(b * N[(b * 3.0), $MachinePrecision]), $MachinePrecision]), $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(4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + -1\right)
\end{array}
\end{array}
Initial program 76.0%
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
Simplified76.0%
Taylor expanded in a around 0
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
(FPCore (a b) :precision binary64 (if (<= (* b b) 5e-40) (+ -1.0 (* (* a a) (+ (* a a) (* 4.0 (- 1.0 a))))) (+ -1.0 (* (* b b) (+ (* b b) (+ 12.0 (* (* a a) 2.0)))))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 5e-40) {
tmp = -1.0 + ((a * a) * ((a * a) + (4.0 * (1.0 - a))));
} else {
tmp = -1.0 + ((b * b) * ((b * b) + (12.0 + ((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) <= 5d-40) then
tmp = (-1.0d0) + ((a * a) * ((a * a) + (4.0d0 * (1.0d0 - a))))
else
tmp = (-1.0d0) + ((b * b) * ((b * b) + (12.0d0 + ((a * a) * 2.0d0))))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 5e-40) {
tmp = -1.0 + ((a * a) * ((a * a) + (4.0 * (1.0 - a))));
} else {
tmp = -1.0 + ((b * b) * ((b * b) + (12.0 + ((a * a) * 2.0))));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 5e-40: tmp = -1.0 + ((a * a) * ((a * a) + (4.0 * (1.0 - a)))) else: tmp = -1.0 + ((b * b) * ((b * b) + (12.0 + ((a * a) * 2.0)))) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 5e-40) tmp = Float64(-1.0 + Float64(Float64(a * a) * Float64(Float64(a * a) + Float64(4.0 * Float64(1.0 - a))))); else tmp = Float64(-1.0 + Float64(Float64(b * b) * Float64(Float64(b * b) + Float64(12.0 + Float64(Float64(a * a) * 2.0))))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 5e-40) tmp = -1.0 + ((a * a) * ((a * a) + (4.0 * (1.0 - a)))); else tmp = -1.0 + ((b * b) * ((b * b) + (12.0 + ((a * a) * 2.0)))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 5e-40], N[(-1.0 + N[(N[(a * a), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] + N[(4.0 * N[(1.0 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + N[(12.0 + N[(N[(a * a), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 5 \cdot 10^{-40}:\\
\;\;\;\;-1 + \left(a \cdot a\right) \cdot \left(a \cdot a + 4 \cdot \left(1 - a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot \left(b \cdot b + \left(12 + \left(a \cdot a\right) \cdot 2\right)\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 4.99999999999999965e-40Initial program 80.1%
Taylor expanded in b around 0
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6499.9%
Simplified99.9%
if 4.99999999999999965e-40 < (*.f64 b b) Initial program 72.9%
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
Simplified72.9%
Taylor expanded in a around 0
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Taylor expanded in a around 0
sub-negN/A
associate-+r+N/A
metadata-evalN/A
sum3-defineN/A
associate-*r*N/A
distribute-rgt-inN/A
+-commutativeN/A
sum3-undefineN/A
metadata-evalN/A
pow-sqrN/A
distribute-lft-inN/A
associate-+r+N/A
Simplified96.3%
Final simplification97.9%
(FPCore (a b)
:precision binary64
(let* ((t_0 (+ -1.0 (* (* a a) (+ (* a a) (* b b))))))
(if (<= a -3.75e+31)
t_0
(if (<= a 1950.0) (+ -1.0 (* (* b b) (+ (* b b) 12.0))) t_0))))
double code(double a, double b) {
double t_0 = -1.0 + ((a * a) * ((a * a) + (b * b)));
double tmp;
if (a <= -3.75e+31) {
tmp = t_0;
} else if (a <= 1950.0) {
tmp = -1.0 + ((b * b) * ((b * b) + 12.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 = (-1.0d0) + ((a * a) * ((a * a) + (b * b)))
if (a <= (-3.75d+31)) then
tmp = t_0
else if (a <= 1950.0d0) then
tmp = (-1.0d0) + ((b * b) * ((b * b) + 12.0d0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = -1.0 + ((a * a) * ((a * a) + (b * b)));
double tmp;
if (a <= -3.75e+31) {
tmp = t_0;
} else if (a <= 1950.0) {
tmp = -1.0 + ((b * b) * ((b * b) + 12.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b): t_0 = -1.0 + ((a * a) * ((a * a) + (b * b))) tmp = 0 if a <= -3.75e+31: tmp = t_0 elif a <= 1950.0: tmp = -1.0 + ((b * b) * ((b * b) + 12.0)) else: tmp = t_0 return tmp
function code(a, b) t_0 = Float64(-1.0 + Float64(Float64(a * a) * Float64(Float64(a * a) + Float64(b * b)))) tmp = 0.0 if (a <= -3.75e+31) tmp = t_0; elseif (a <= 1950.0) tmp = Float64(-1.0 + Float64(Float64(b * b) * Float64(Float64(b * b) + 12.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b) t_0 = -1.0 + ((a * a) * ((a * a) + (b * b))); tmp = 0.0; if (a <= -3.75e+31) tmp = t_0; elseif (a <= 1950.0) tmp = -1.0 + ((b * b) * ((b * b) + 12.0)); else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(-1.0 + N[(N[(a * a), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -3.75e+31], t$95$0, If[LessEqual[a, 1950.0], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1 + \left(a \cdot a\right) \cdot \left(a \cdot a + b \cdot b\right)\\
\mathbf{if}\;a \leq -3.75 \cdot 10^{+31}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 1950:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot \left(b \cdot b + 12\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -3.75e31 or 1950 < a Initial program 48.6%
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
Simplified48.6%
Taylor expanded in a around 0
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6499.9%
Simplified99.9%
Taylor expanded in b around 0
Simplified99.9%
Taylor expanded in a around inf
unpow2N/A
*-lowering-*.f6498.0%
Simplified98.0%
if -3.75e31 < a < 1950Initial program 99.1%
Taylor expanded in a around 0
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6498.1%
Simplified98.1%
Final simplification98.1%
(FPCore (a b) :precision binary64 (if (<= (* b b) 20000000.0) (+ -1.0 (* a (* a (+ (* a a) (* b (* b 2.0)))))) (+ -1.0 (* (* b b) (+ (* b b) (* (* a a) 2.0))))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 20000000.0) {
tmp = -1.0 + (a * (a * ((a * a) + (b * (b * 2.0)))));
} else {
tmp = -1.0 + ((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) <= 20000000.0d0) then
tmp = (-1.0d0) + (a * (a * ((a * a) + (b * (b * 2.0d0)))))
else
tmp = (-1.0d0) + ((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) <= 20000000.0) {
tmp = -1.0 + (a * (a * ((a * a) + (b * (b * 2.0)))));
} else {
tmp = -1.0 + ((b * b) * ((b * b) + ((a * a) * 2.0)));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 20000000.0: tmp = -1.0 + (a * (a * ((a * a) + (b * (b * 2.0))))) else: tmp = -1.0 + ((b * b) * ((b * b) + ((a * a) * 2.0))) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 20000000.0) tmp = Float64(-1.0 + Float64(a * Float64(a * Float64(Float64(a * a) + Float64(b * Float64(b * 2.0)))))); else tmp = Float64(-1.0 + 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) <= 20000000.0) tmp = -1.0 + (a * (a * ((a * a) + (b * (b * 2.0))))); else tmp = -1.0 + ((b * b) * ((b * b) + ((a * a) * 2.0))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 20000000.0], N[(-1.0 + N[(a * N[(a * N[(N[(a * a), $MachinePrecision] + N[(b * N[(b * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + N[(N[(a * a), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 20000000:\\
\;\;\;\;-1 + a \cdot \left(a \cdot \left(a \cdot a + b \cdot \left(b \cdot 2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \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) < 2e7Initial program 80.2%
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
Simplified80.2%
Taylor expanded in a around 0
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Taylor expanded in b around 0
Simplified98.3%
Taylor expanded in b around 0
sub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-sqrN/A
distribute-lft-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
Simplified98.3%
if 2e7 < (*.f64 b b) Initial program 72.2%
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
Simplified72.2%
Taylor expanded in a around 0
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Taylor expanded in b around 0
Simplified99.7%
Taylor expanded in a around 0
sub-negN/A
metadata-evalN/A
metadata-evalN/A
pow-sqrN/A
associate-*r*N/A
distribute-rgt-inN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6497.2%
Simplified97.2%
Final simplification97.7%
(FPCore (a b) :precision binary64 (if (<= (* b b) 20000000.0) (+ -1.0 (* a (* a (+ (* a a) (* b (* b 2.0)))))) (+ -1.0 (* (* b b) (+ (* a a) (* b b))))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 20000000.0) {
tmp = -1.0 + (a * (a * ((a * a) + (b * (b * 2.0)))));
} else {
tmp = -1.0 + ((b * b) * ((a * a) + (b * b)));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b * b) <= 20000000.0d0) then
tmp = (-1.0d0) + (a * (a * ((a * a) + (b * (b * 2.0d0)))))
else
tmp = (-1.0d0) + ((b * b) * ((a * a) + (b * b)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 20000000.0) {
tmp = -1.0 + (a * (a * ((a * a) + (b * (b * 2.0)))));
} else {
tmp = -1.0 + ((b * b) * ((a * a) + (b * b)));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 20000000.0: tmp = -1.0 + (a * (a * ((a * a) + (b * (b * 2.0))))) else: tmp = -1.0 + ((b * b) * ((a * a) + (b * b))) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 20000000.0) tmp = Float64(-1.0 + Float64(a * Float64(a * Float64(Float64(a * a) + Float64(b * Float64(b * 2.0)))))); else tmp = Float64(-1.0 + Float64(Float64(b * b) * Float64(Float64(a * a) + Float64(b * b)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 20000000.0) tmp = -1.0 + (a * (a * ((a * a) + (b * (b * 2.0))))); else tmp = -1.0 + ((b * b) * ((a * a) + (b * b))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 20000000.0], N[(-1.0 + N[(a * N[(a * N[(N[(a * a), $MachinePrecision] + N[(b * N[(b * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 20000000:\\
\;\;\;\;-1 + a \cdot \left(a \cdot \left(a \cdot a + b \cdot \left(b \cdot 2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 2e7Initial program 80.2%
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
Simplified80.2%
Taylor expanded in a around 0
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Taylor expanded in b around 0
Simplified98.3%
Taylor expanded in b around 0
sub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-sqrN/A
distribute-lft-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
Simplified98.3%
if 2e7 < (*.f64 b b) Initial program 72.2%
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
Simplified72.2%
Taylor expanded in a around 0
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Taylor expanded in b around 0
Simplified99.7%
Taylor expanded in a around 0
unpow2N/A
*-lowering-*.f6496.7%
Simplified96.7%
Final simplification97.4%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* a (* a (* a a)))))
(if (<= a -2.25e+76)
t_0
(if (<= a 9.2e+38) (+ -1.0 (* (* b b) (+ (* b b) 12.0))) t_0))))
double code(double a, double b) {
double t_0 = a * (a * (a * a));
double tmp;
if (a <= -2.25e+76) {
tmp = t_0;
} else if (a <= 9.2e+38) {
tmp = -1.0 + ((b * b) * ((b * b) + 12.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 <= (-2.25d+76)) then
tmp = t_0
else if (a <= 9.2d+38) then
tmp = (-1.0d0) + ((b * b) * ((b * b) + 12.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 <= -2.25e+76) {
tmp = t_0;
} else if (a <= 9.2e+38) {
tmp = -1.0 + ((b * b) * ((b * b) + 12.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b): t_0 = a * (a * (a * a)) tmp = 0 if a <= -2.25e+76: tmp = t_0 elif a <= 9.2e+38: tmp = -1.0 + ((b * b) * ((b * b) + 12.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 <= -2.25e+76) tmp = t_0; elseif (a <= 9.2e+38) tmp = Float64(-1.0 + Float64(Float64(b * b) * Float64(Float64(b * b) + 12.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 <= -2.25e+76) tmp = t_0; elseif (a <= 9.2e+38) tmp = -1.0 + ((b * b) * ((b * b) + 12.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, -2.25e+76], t$95$0, If[LessEqual[a, 9.2e+38], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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 -2.25 \cdot 10^{+76}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 9.2 \cdot 10^{+38}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot \left(b \cdot b + 12\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -2.2499999999999999e76 or 9.2000000000000005e38 < a Initial program 45.9%
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
Simplified45.9%
Taylor expanded in a around inf
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6496.6%
Simplified96.6%
if -2.2499999999999999e76 < a < 9.2000000000000005e38Initial program 95.3%
Taylor expanded in a around 0
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6494.4%
Simplified94.4%
Final simplification95.3%
(FPCore (a b) :precision binary64 (if (<= (* b b) 0.001) (+ -1.0 (* (* a a) 4.0)) (if (<= (* b b) 2e+57) (* a (* a (* a a))) (* b (* b (* b b))))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 0.001) {
tmp = -1.0 + ((a * a) * 4.0);
} else if ((b * b) <= 2e+57) {
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) <= 0.001d0) then
tmp = (-1.0d0) + ((a * a) * 4.0d0)
else if ((b * b) <= 2d+57) 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) <= 0.001) {
tmp = -1.0 + ((a * a) * 4.0);
} else if ((b * b) <= 2e+57) {
tmp = a * (a * (a * a));
} else {
tmp = b * (b * (b * b));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 0.001: tmp = -1.0 + ((a * a) * 4.0) elif (b * b) <= 2e+57: tmp = a * (a * (a * a)) else: tmp = b * (b * (b * b)) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 0.001) tmp = Float64(-1.0 + Float64(Float64(a * a) * 4.0)); elseif (Float64(b * b) <= 2e+57) 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) <= 0.001) tmp = -1.0 + ((a * a) * 4.0); elseif ((b * b) <= 2e+57) 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], 0.001], N[(-1.0 + N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(b * b), $MachinePrecision], 2e+57], 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 0.001:\\
\;\;\;\;-1 + \left(a \cdot a\right) \cdot 4\\
\mathbf{elif}\;b \cdot b \leq 2 \cdot 10^{+57}:\\
\;\;\;\;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) < 1e-3Initial program 80.7%
Taylor expanded in a around 0
+-commutativeN/A
associate-+l+N/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
Simplified81.3%
Taylor expanded in b around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6479.7%
Simplified79.7%
if 1e-3 < (*.f64 b b) < 2.0000000000000001e57Initial program 56.1%
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
Simplified56.1%
Taylor expanded in a around inf
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6476.2%
Simplified76.2%
if 2.0000000000000001e57 < (*.f64 b b) Initial program 74.0%
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.0%
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.5%
Simplified90.5%
Final simplification84.5%
(FPCore (a b)
:precision binary64
(let* ((t_0 (+ (* a a) (* b b))))
(if (<= (* b b) 20000000.0)
(+ -1.0 (* (* a a) t_0))
(+ -1.0 (* (* b b) t_0)))))
double code(double a, double b) {
double t_0 = (a * a) + (b * b);
double tmp;
if ((b * b) <= 20000000.0) {
tmp = -1.0 + ((a * a) * t_0);
} else {
tmp = -1.0 + ((b * b) * 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) + (b * b)
if ((b * b) <= 20000000.0d0) then
tmp = (-1.0d0) + ((a * a) * t_0)
else
tmp = (-1.0d0) + ((b * b) * t_0)
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = (a * a) + (b * b);
double tmp;
if ((b * b) <= 20000000.0) {
tmp = -1.0 + ((a * a) * t_0);
} else {
tmp = -1.0 + ((b * b) * t_0);
}
return tmp;
}
def code(a, b): t_0 = (a * a) + (b * b) tmp = 0 if (b * b) <= 20000000.0: tmp = -1.0 + ((a * a) * t_0) else: tmp = -1.0 + ((b * b) * t_0) return tmp
function code(a, b) t_0 = Float64(Float64(a * a) + Float64(b * b)) tmp = 0.0 if (Float64(b * b) <= 20000000.0) tmp = Float64(-1.0 + Float64(Float64(a * a) * t_0)); else tmp = Float64(-1.0 + Float64(Float64(b * b) * t_0)); end return tmp end
function tmp_2 = code(a, b) t_0 = (a * a) + (b * b); tmp = 0.0; if ((b * b) <= 20000000.0) tmp = -1.0 + ((a * a) * t_0); else tmp = -1.0 + ((b * b) * t_0); end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(b * b), $MachinePrecision], 20000000.0], N[(-1.0 + N[(N[(a * a), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot a + b \cdot b\\
\mathbf{if}\;b \cdot b \leq 20000000:\\
\;\;\;\;-1 + \left(a \cdot a\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot t\_0\\
\end{array}
\end{array}
if (*.f64 b b) < 2e7Initial program 80.2%
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
Simplified80.2%
Taylor expanded in a around 0
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Taylor expanded in b around 0
Simplified98.3%
Taylor expanded in a around inf
unpow2N/A
*-lowering-*.f6498.3%
Simplified98.3%
if 2e7 < (*.f64 b b) Initial program 72.2%
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
Simplified72.2%
Taylor expanded in a around 0
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Taylor expanded in b around 0
Simplified99.7%
Taylor expanded in a around 0
unpow2N/A
*-lowering-*.f6496.7%
Simplified96.7%
Final simplification97.4%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* a (* a (* a a)))))
(if (<= a -2.3e+76)
t_0
(if (<= a 6.8e+38) (+ -1.0 (* b (* b (* b b)))) t_0))))
double code(double a, double b) {
double t_0 = a * (a * (a * a));
double tmp;
if (a <= -2.3e+76) {
tmp = t_0;
} else if (a <= 6.8e+38) {
tmp = -1.0 + (b * (b * (b * b)));
} 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 <= (-2.3d+76)) then
tmp = t_0
else if (a <= 6.8d+38) then
tmp = (-1.0d0) + (b * (b * (b * b)))
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 <= -2.3e+76) {
tmp = t_0;
} else if (a <= 6.8e+38) {
tmp = -1.0 + (b * (b * (b * b)));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b): t_0 = a * (a * (a * a)) tmp = 0 if a <= -2.3e+76: tmp = t_0 elif a <= 6.8e+38: tmp = -1.0 + (b * (b * (b * b))) else: tmp = t_0 return tmp
function code(a, b) t_0 = Float64(a * Float64(a * Float64(a * a))) tmp = 0.0 if (a <= -2.3e+76) tmp = t_0; elseif (a <= 6.8e+38) tmp = Float64(-1.0 + Float64(b * Float64(b * Float64(b * b)))); 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 <= -2.3e+76) tmp = t_0; elseif (a <= 6.8e+38) tmp = -1.0 + (b * (b * (b * b))); 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, -2.3e+76], t$95$0, If[LessEqual[a, 6.8e+38], N[(-1.0 + N[(b * N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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 -2.3 \cdot 10^{+76}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 6.8 \cdot 10^{+38}:\\
\;\;\;\;-1 + b \cdot \left(b \cdot \left(b \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -2.30000000000000001e76 or 6.79999999999999992e38 < a Initial program 45.9%
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
Simplified45.9%
Taylor expanded in a around inf
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6496.6%
Simplified96.6%
if -2.30000000000000001e76 < a < 6.79999999999999992e38Initial program 95.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-*.f6493.1%
Simplified93.1%
Final simplification94.5%
(FPCore (a b) :precision binary64 (let* ((t_0 (* a (* a (* a a))))) (if (<= a -0.0125) t_0 (if (<= a 0.0029) -1.0 t_0))))
double code(double a, double b) {
double t_0 = a * (a * (a * a));
double tmp;
if (a <= -0.0125) {
tmp = t_0;
} else if (a <= 0.0029) {
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 <= (-0.0125d0)) then
tmp = t_0
else if (a <= 0.0029d0) 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 <= -0.0125) {
tmp = t_0;
} else if (a <= 0.0029) {
tmp = -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b): t_0 = a * (a * (a * a)) tmp = 0 if a <= -0.0125: tmp = t_0 elif a <= 0.0029: 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 <= -0.0125) tmp = t_0; elseif (a <= 0.0029) 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 <= -0.0125) tmp = t_0; elseif (a <= 0.0029) 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, -0.0125], t$95$0, If[LessEqual[a, 0.0029], -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 -0.0125:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 0.0029:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -0.012500000000000001 or 0.0029 < a Initial program 52.6%
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
Simplified52.6%
Taylor expanded in a around inf
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6481.3%
Simplified81.3%
if -0.012500000000000001 < a < 0.0029Initial program 99.9%
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.2%
Simplified98.2%
Taylor expanded in b around 0
Simplified46.1%
(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 76.0%
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
Simplified76.0%
Taylor expanded in a around 0
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Taylor expanded in b around 0
Simplified99.0%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e+57) (* a (* a (* a a))) (* b (* b (* b b)))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+57) {
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+57) 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+57) {
tmp = a * (a * (a * a));
} else {
tmp = b * (b * (b * b));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e+57: 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+57) 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+57) 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+57], 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^{+57}:\\
\;\;\;\;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) < 2.0000000000000001e57Initial program 77.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
Simplified77.8%
Taylor expanded in a around inf
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6454.2%
Simplified54.2%
if 2.0000000000000001e57 < (*.f64 b b) Initial program 74.0%
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.0%
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.5%
Simplified90.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.0%
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-*.f6466.8%
Simplified66.8%
Taylor expanded in b around 0
Simplified23.2%
herbie shell --seed 2024139
(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))