
(FPCore (a b) :precision binary64 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) 1.0))
double code(double a, double b) {
return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 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 * (b * b))) - 1.0d0
end function
public static double code(double a, double b) {
return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0;
}
def code(a, b): return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0
function code(a, b) return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(b * b))) - 1.0) end
function tmp = code(a, b) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (b * b))) - 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[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b) :precision binary64 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) 1.0))
double code(double a, double b) {
return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 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 * (b * b))) - 1.0d0
end function
public static double code(double a, double b) {
return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0;
}
def code(a, b): return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0
function code(a, b) return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(b * b))) - 1.0) end
function tmp = code(a, b) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (b * b))) - 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[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
\end{array}
(FPCore (a b) :precision binary64 (+ (pow (hypot a b) 4.0) (fma b (* b 4.0) -1.0)))
double code(double a, double b) {
return pow(hypot(a, b), 4.0) + fma(b, (b * 4.0), -1.0);
}
function code(a, b) return Float64((hypot(a, b) ^ 4.0) + fma(b, Float64(b * 4.0), -1.0)) end
code[a_, b_] := N[(N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision] + N[(b * N[(b * 4.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(b, b \cdot 4, -1\right)
\end{array}
Initial program 99.9%
associate--l+99.9%
unpow299.8%
unpow199.8%
sqr-pow99.8%
associate-*r*99.9%
Simplified100.0%
Final simplification100.0%
(FPCore (a b) :precision binary64 (if (<= (* b b) 5000000.0) (+ (pow a 4.0) -1.0) (+ (pow b 4.0) (* (* b b) (+ 4.0 (* (* a a) 2.0))))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 5000000.0) {
tmp = pow(a, 4.0) + -1.0;
} else {
tmp = pow(b, 4.0) + ((b * b) * (4.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) <= 5000000.0d0) then
tmp = (a ** 4.0d0) + (-1.0d0)
else
tmp = (b ** 4.0d0) + ((b * b) * (4.0d0 + ((a * a) * 2.0d0)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 5000000.0) {
tmp = Math.pow(a, 4.0) + -1.0;
} else {
tmp = Math.pow(b, 4.0) + ((b * b) * (4.0 + ((a * a) * 2.0)));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 5000000.0: tmp = math.pow(a, 4.0) + -1.0 else: tmp = math.pow(b, 4.0) + ((b * b) * (4.0 + ((a * a) * 2.0))) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 5000000.0) tmp = Float64((a ^ 4.0) + -1.0); else tmp = Float64((b ^ 4.0) + Float64(Float64(b * b) * Float64(4.0 + Float64(Float64(a * a) * 2.0)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 5000000.0) tmp = (a ^ 4.0) + -1.0; else tmp = (b ^ 4.0) + ((b * b) * (4.0 + ((a * a) * 2.0))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 5000000.0], N[(N[Power[a, 4.0], $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[b, 4.0], $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(4.0 + N[(N[(a * a), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 5000000:\\
\;\;\;\;{a}^{4} + -1\\
\mathbf{else}:\\
\;\;\;\;{b}^{4} + \left(b \cdot b\right) \cdot \left(4 + \left(a \cdot a\right) \cdot 2\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 5e6Initial program 99.8%
associate--l+99.8%
unpow299.8%
unpow199.8%
sqr-pow99.8%
associate-*r*99.9%
Simplified100.0%
Taylor expanded in b around 0 98.6%
if 5e6 < (*.f64 b b) Initial program 99.9%
associate--l+99.9%
unpow299.9%
unpow199.9%
sqr-pow99.9%
associate-*r*99.9%
Simplified100.0%
Taylor expanded in b around inf 97.3%
*-commutative97.3%
unpow297.3%
unpow297.3%
Simplified97.3%
Final simplification97.9%
(FPCore (a b) :precision binary64 (if (<= (* b b) 5000000.0) (+ (pow a 4.0) -1.0) (* (* b b) (+ (* b b) (fma 2.0 (* a a) 4.0)))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 5000000.0) {
tmp = pow(a, 4.0) + -1.0;
} else {
tmp = (b * b) * ((b * b) + fma(2.0, (a * a), 4.0));
}
return tmp;
}
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 5000000.0) tmp = Float64((a ^ 4.0) + -1.0); else tmp = Float64(Float64(b * b) * Float64(Float64(b * b) + fma(2.0, Float64(a * a), 4.0))); end return tmp end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 5000000.0], N[(N[Power[a, 4.0], $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + N[(2.0 * N[(a * a), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 5000000:\\
\;\;\;\;{a}^{4} + -1\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(b \cdot b + \mathsf{fma}\left(2, a \cdot a, 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 5e6Initial program 99.8%
associate--l+99.8%
unpow299.8%
unpow199.8%
sqr-pow99.8%
associate-*r*99.9%
Simplified100.0%
Taylor expanded in b around 0 98.6%
if 5e6 < (*.f64 b b) Initial program 99.9%
associate--l+99.9%
unpow299.9%
unpow199.9%
sqr-pow99.9%
associate-*r*99.9%
Simplified100.0%
Taylor expanded in b around inf 97.3%
*-commutative97.3%
unpow297.3%
unpow297.3%
Simplified97.3%
+-commutative97.3%
metadata-eval97.3%
pow-prod-up97.1%
pow297.1%
pow297.1%
distribute-lft-out97.1%
+-commutative97.1%
fma-def97.1%
Applied egg-rr97.1%
Final simplification97.8%
(FPCore (a b) :precision binary64 (+ (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) -1.0))
double code(double a, double b) {
return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) + -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 * (b * b))) + (-1.0d0)
end function
public static double code(double a, double b) {
return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) + -1.0;
}
def code(a, b): return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) + -1.0
function code(a, b) return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(b * b))) + -1.0) end
function tmp = code(a, b) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (b * b))) + -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[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) + -1
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e+48) (+ (pow a 4.0) -1.0) (+ (* 4.0 (* b b)) (pow b 4.0))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+48) {
tmp = pow(a, 4.0) + -1.0;
} else {
tmp = (4.0 * (b * b)) + pow(b, 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b * b) <= 2d+48) then
tmp = (a ** 4.0d0) + (-1.0d0)
else
tmp = (4.0d0 * (b * b)) + (b ** 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+48) {
tmp = Math.pow(a, 4.0) + -1.0;
} else {
tmp = (4.0 * (b * b)) + Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e+48: tmp = math.pow(a, 4.0) + -1.0 else: tmp = (4.0 * (b * b)) + math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e+48) tmp = Float64((a ^ 4.0) + -1.0); else tmp = Float64(Float64(4.0 * Float64(b * b)) + (b ^ 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e+48) tmp = (a ^ 4.0) + -1.0; else tmp = (4.0 * (b * b)) + (b ^ 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e+48], N[(N[Power[a, 4.0], $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision] + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{+48}:\\
\;\;\;\;{a}^{4} + -1\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \left(b \cdot b\right) + {b}^{4}\\
\end{array}
\end{array}
if (*.f64 b b) < 2.00000000000000009e48Initial program 99.8%
associate--l+99.8%
unpow299.8%
unpow199.8%
sqr-pow99.8%
associate-*r*99.9%
Simplified100.0%
Taylor expanded in b around 0 97.2%
if 2.00000000000000009e48 < (*.f64 b b) Initial program 99.9%
associate--l+99.9%
unpow299.9%
unpow199.9%
sqr-pow99.9%
associate-*r*99.9%
Simplified100.0%
Taylor expanded in b around inf 98.6%
*-commutative98.6%
unpow298.6%
unpow298.6%
Simplified98.6%
Taylor expanded in a around 0 94.0%
unpow294.0%
Simplified94.0%
Final simplification95.6%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e+48) (+ (pow a 4.0) -1.0) (pow b 4.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+48) {
tmp = pow(a, 4.0) + -1.0;
} else {
tmp = pow(b, 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b * b) <= 2d+48) then
tmp = (a ** 4.0d0) + (-1.0d0)
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+48) {
tmp = Math.pow(a, 4.0) + -1.0;
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e+48: tmp = math.pow(a, 4.0) + -1.0 else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e+48) tmp = Float64((a ^ 4.0) + -1.0); else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e+48) tmp = (a ^ 4.0) + -1.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e+48], N[(N[Power[a, 4.0], $MachinePrecision] + -1.0), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{+48}:\\
\;\;\;\;{a}^{4} + -1\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if (*.f64 b b) < 2.00000000000000009e48Initial program 99.8%
associate--l+99.8%
unpow299.8%
unpow199.8%
sqr-pow99.8%
associate-*r*99.9%
Simplified100.0%
Taylor expanded in b around 0 97.2%
if 2.00000000000000009e48 < (*.f64 b b) Initial program 99.9%
associate--l+99.9%
unpow299.9%
unpow199.9%
sqr-pow99.9%
associate-*r*99.9%
Simplified100.0%
Taylor expanded in b around inf 98.6%
*-commutative98.6%
unpow298.6%
unpow298.6%
Simplified98.6%
Taylor expanded in b around inf 94.0%
Final simplification95.6%
(FPCore (a b) :precision binary64 (if (<= (* a a) 4.15e+61) (* (* b b) (* b b)) (* 2.0 (* b (* b (* a a))))))
double code(double a, double b) {
double tmp;
if ((a * a) <= 4.15e+61) {
tmp = (b * b) * (b * b);
} else {
tmp = 2.0 * (b * (b * (a * a)));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a * a) <= 4.15d+61) then
tmp = (b * b) * (b * b)
else
tmp = 2.0d0 * (b * (b * (a * a)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a * a) <= 4.15e+61) {
tmp = (b * b) * (b * b);
} else {
tmp = 2.0 * (b * (b * (a * a)));
}
return tmp;
}
def code(a, b): tmp = 0 if (a * a) <= 4.15e+61: tmp = (b * b) * (b * b) else: tmp = 2.0 * (b * (b * (a * a))) return tmp
function code(a, b) tmp = 0.0 if (Float64(a * a) <= 4.15e+61) tmp = Float64(Float64(b * b) * Float64(b * b)); else tmp = Float64(2.0 * Float64(b * Float64(b * Float64(a * a)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a * a) <= 4.15e+61) tmp = (b * b) * (b * b); else tmp = 2.0 * (b * (b * (a * a))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(a * a), $MachinePrecision], 4.15e+61], N[(N[(b * b), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(b * N[(b * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot a \leq 4.15 \cdot 10^{+61}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(b \cdot \left(b \cdot \left(a \cdot a\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 a a) < 4.15000000000000025e61Initial program 99.8%
associate--l+99.8%
unpow299.8%
unpow199.8%
sqr-pow99.8%
associate-*r*99.9%
Simplified100.0%
Taylor expanded in b around inf 58.4%
*-commutative58.4%
unpow258.4%
unpow258.4%
Simplified58.4%
+-commutative58.4%
metadata-eval58.4%
pow-prod-up58.2%
pow258.2%
pow258.2%
distribute-lft-out58.2%
+-commutative58.2%
fma-def58.2%
Applied egg-rr58.2%
Taylor expanded in b around inf 57.9%
unpow257.9%
Simplified57.9%
if 4.15000000000000025e61 < (*.f64 a a) Initial program 99.9%
associate--l+99.9%
unpow299.9%
unpow199.9%
sqr-pow99.9%
associate-*r*99.9%
Simplified100.0%
Taylor expanded in b around inf 59.5%
*-commutative59.5%
unpow259.5%
unpow259.5%
Simplified59.5%
+-commutative59.5%
metadata-eval59.5%
pow-prod-up59.5%
pow259.5%
pow259.5%
distribute-lft-out59.5%
+-commutative59.5%
fma-def59.5%
Applied egg-rr59.5%
Taylor expanded in a around inf 59.5%
unpow259.5%
unpow259.5%
*-commutative59.5%
associate-*l*71.0%
Simplified71.0%
Final simplification63.7%
(FPCore (a b) :precision binary64 (if (<= (* a a) 2.7e+61) (* (* b b) (+ 4.0 (* b b))) (* 2.0 (* b (* b (* a a))))))
double code(double a, double b) {
double tmp;
if ((a * a) <= 2.7e+61) {
tmp = (b * b) * (4.0 + (b * b));
} else {
tmp = 2.0 * (b * (b * (a * a)));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a * a) <= 2.7d+61) then
tmp = (b * b) * (4.0d0 + (b * b))
else
tmp = 2.0d0 * (b * (b * (a * a)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a * a) <= 2.7e+61) {
tmp = (b * b) * (4.0 + (b * b));
} else {
tmp = 2.0 * (b * (b * (a * a)));
}
return tmp;
}
def code(a, b): tmp = 0 if (a * a) <= 2.7e+61: tmp = (b * b) * (4.0 + (b * b)) else: tmp = 2.0 * (b * (b * (a * a))) return tmp
function code(a, b) tmp = 0.0 if (Float64(a * a) <= 2.7e+61) tmp = Float64(Float64(b * b) * Float64(4.0 + Float64(b * b))); else tmp = Float64(2.0 * Float64(b * Float64(b * Float64(a * a)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a * a) <= 2.7e+61) tmp = (b * b) * (4.0 + (b * b)); else tmp = 2.0 * (b * (b * (a * a))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(a * a), $MachinePrecision], 2.7e+61], N[(N[(b * b), $MachinePrecision] * N[(4.0 + N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(b * N[(b * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot a \leq 2.7 \cdot 10^{+61}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(b \cdot \left(b \cdot \left(a \cdot a\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 a a) < 2.7000000000000002e61Initial program 99.8%
associate--l+99.8%
unpow299.8%
unpow199.8%
sqr-pow99.8%
associate-*r*99.9%
Simplified100.0%
Taylor expanded in b around inf 58.4%
*-commutative58.4%
unpow258.4%
unpow258.4%
Simplified58.4%
Taylor expanded in a around 0 58.4%
unpow258.4%
Simplified58.4%
+-commutative58.4%
metadata-eval58.4%
pow-sqr58.2%
pow258.2%
pow258.2%
distribute-rgt-out58.2%
Applied egg-rr58.2%
if 2.7000000000000002e61 < (*.f64 a a) Initial program 99.9%
associate--l+99.9%
unpow299.9%
unpow199.9%
sqr-pow99.9%
associate-*r*99.9%
Simplified100.0%
Taylor expanded in b around inf 59.5%
*-commutative59.5%
unpow259.5%
unpow259.5%
Simplified59.5%
+-commutative59.5%
metadata-eval59.5%
pow-prod-up59.5%
pow259.5%
pow259.5%
distribute-lft-out59.5%
+-commutative59.5%
fma-def59.5%
Applied egg-rr59.5%
Taylor expanded in a around inf 59.5%
unpow259.5%
unpow259.5%
*-commutative59.5%
associate-*l*71.0%
Simplified71.0%
Final simplification63.9%
(FPCore (a b) :precision binary64 (* (* b b) (* b b)))
double code(double a, double b) {
return (b * b) * (b * b);
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (b * b) * (b * b)
end function
public static double code(double a, double b) {
return (b * b) * (b * b);
}
def code(a, b): return (b * b) * (b * b)
function code(a, b) return Float64(Float64(b * b) * Float64(b * b)) end
function tmp = code(a, b) tmp = (b * b) * (b * b); end
code[a_, b_] := N[(N[(b * b), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(b \cdot b\right) \cdot \left(b \cdot b\right)
\end{array}
Initial program 99.9%
associate--l+99.9%
unpow299.8%
unpow199.8%
sqr-pow99.8%
associate-*r*99.9%
Simplified100.0%
Taylor expanded in b around inf 58.9%
*-commutative58.9%
unpow258.9%
unpow258.9%
Simplified58.9%
+-commutative58.9%
metadata-eval58.9%
pow-prod-up58.8%
pow258.8%
pow258.8%
distribute-lft-out58.8%
+-commutative58.8%
fma-def58.8%
Applied egg-rr58.8%
Taylor expanded in b around inf 48.3%
unpow248.3%
Simplified48.3%
Final simplification48.3%
(FPCore (a b) :precision binary64 (* 4.0 (* b b)))
double code(double a, double b) {
return 4.0 * (b * b);
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = 4.0d0 * (b * b)
end function
public static double code(double a, double b) {
return 4.0 * (b * b);
}
def code(a, b): return 4.0 * (b * b)
function code(a, b) return Float64(4.0 * Float64(b * b)) end
function tmp = code(a, b) tmp = 4.0 * (b * b); end
code[a_, b_] := N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
4 \cdot \left(b \cdot b\right)
\end{array}
Initial program 99.9%
associate--l+99.9%
unpow299.8%
unpow199.8%
sqr-pow99.8%
associate-*r*99.9%
Simplified100.0%
Taylor expanded in b around inf 58.9%
*-commutative58.9%
unpow258.9%
unpow258.9%
Simplified58.9%
Taylor expanded in a around 0 48.6%
unpow248.6%
Simplified48.6%
Taylor expanded in b around 0 24.2%
unpow224.2%
Simplified24.2%
Final simplification24.2%
herbie shell --seed 2023255
(FPCore (a b)
:name "Bouland and Aaronson, Equation (26)"
:precision binary64
(- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) 1.0))