
(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 8 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 (+ (+ (pow (hypot b a) 4.0) (* 4.0 (+ (* a a) (* (* b b) 3.0)))) -1.0))
double code(double a, double b) {
return (pow(hypot(b, a), 4.0) + (4.0 * ((a * a) + ((b * b) * 3.0)))) + -1.0;
}
public static double code(double a, double b) {
return (Math.pow(Math.hypot(b, a), 4.0) + (4.0 * ((a * a) + ((b * b) * 3.0)))) + -1.0;
}
def code(a, b): return (math.pow(math.hypot(b, a), 4.0) + (4.0 * ((a * a) + ((b * b) * 3.0)))) + -1.0
function code(a, b) return Float64(Float64((hypot(b, a) ^ 4.0) + Float64(4.0 * Float64(Float64(a * a) + Float64(Float64(b * b) * 3.0)))) + -1.0) end
function tmp = code(a, b) tmp = ((hypot(b, a) ^ 4.0) + (4.0 * ((a * a) + ((b * b) * 3.0)))) + -1.0; end
code[a_, b_] := N[(N[(N[Power[N[Sqrt[b ^ 2 + a ^ 2], $MachinePrecision], 4.0], $MachinePrecision] + N[(4.0 * N[(N[(a * a), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\mathsf{hypot}\left(b, a\right)\right)}^{4} + 4 \cdot \left(a \cdot a + \left(b \cdot b\right) \cdot 3\right)\right) + -1
\end{array}
Initial program 76.0%
Taylor expanded in a around 0 91.3%
fma-define91.3%
add-sqr-sqrt91.3%
fma-define91.3%
+-commutative91.3%
hypot-undefine91.3%
fma-define91.3%
+-commutative91.3%
hypot-undefine91.3%
unpow-prod-down91.3%
Applied egg-rr91.3%
pow-sqr91.4%
metadata-eval91.4%
Simplified91.4%
Taylor expanded in a around 0 100.0%
Final simplification100.0%
(FPCore (a b)
:precision binary64
(if (<= (* b b) 5e+134)
(+
(+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* a a) (* (* b b) (+ a 3.0)))))
-1.0)
(+ (+ (* 4.0 (+ (* a a) (* (* b b) 3.0))) (pow b 4.0)) -1.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 5e+134) {
tmp = (pow(((a * a) + (b * b)), 2.0) + (4.0 * ((a * a) + ((b * b) * (a + 3.0))))) + -1.0;
} else {
tmp = ((4.0 * ((a * a) + ((b * b) * 3.0))) + pow(b, 4.0)) + -1.0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b * b) <= 5d+134) then
tmp = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * ((a * a) + ((b * b) * (a + 3.0d0))))) + (-1.0d0)
else
tmp = ((4.0d0 * ((a * a) + ((b * b) * 3.0d0))) + (b ** 4.0d0)) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 5e+134) {
tmp = (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * ((a * a) + ((b * b) * (a + 3.0))))) + -1.0;
} else {
tmp = ((4.0 * ((a * a) + ((b * b) * 3.0))) + Math.pow(b, 4.0)) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 5e+134: tmp = (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * ((a * a) + ((b * b) * (a + 3.0))))) + -1.0 else: tmp = ((4.0 * ((a * a) + ((b * b) * 3.0))) + math.pow(b, 4.0)) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 5e+134) tmp = Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(a * a) + Float64(Float64(b * b) * Float64(a + 3.0))))) + -1.0); else tmp = Float64(Float64(Float64(4.0 * Float64(Float64(a * a) + Float64(Float64(b * b) * 3.0))) + (b ^ 4.0)) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 5e+134) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * ((a * a) + ((b * b) * (a + 3.0))))) + -1.0; else tmp = ((4.0 * ((a * a) + ((b * b) * 3.0))) + (b ^ 4.0)) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 5e+134], N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(a * a), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[(4.0 * N[(N[(a * a), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 5 \cdot 10^{+134}:\\
\;\;\;\;\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(a \cdot a + \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left(4 \cdot \left(a \cdot a + \left(b \cdot b\right) \cdot 3\right) + {b}^{4}\right) + -1\\
\end{array}
\end{array}
if (*.f64 b b) < 4.99999999999999981e134Initial program 78.7%
Taylor expanded in a around 0 97.3%
if 4.99999999999999981e134 < (*.f64 b b) Initial program 71.5%
Taylor expanded in a around 0 81.0%
fma-define81.0%
add-sqr-sqrt81.0%
fma-define81.0%
+-commutative81.0%
hypot-undefine81.0%
fma-define81.0%
+-commutative81.0%
hypot-undefine81.0%
unpow-prod-down81.0%
Applied egg-rr81.0%
pow-sqr81.1%
metadata-eval81.1%
Simplified81.1%
Taylor expanded in a around 0 100.0%
Taylor expanded in b around inf 100.0%
Final simplification98.3%
(FPCore (a b) :precision binary64 (if (or (<= a -2.6e+76) (not (<= a 8e+39))) (pow a 4.0) (+ (+ (* 4.0 (+ (* a a) (* (* b b) 3.0))) (pow b 4.0)) -1.0)))
double code(double a, double b) {
double tmp;
if ((a <= -2.6e+76) || !(a <= 8e+39)) {
tmp = pow(a, 4.0);
} else {
tmp = ((4.0 * ((a * a) + ((b * b) * 3.0))) + pow(b, 4.0)) + -1.0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-2.6d+76)) .or. (.not. (a <= 8d+39))) then
tmp = a ** 4.0d0
else
tmp = ((4.0d0 * ((a * a) + ((b * b) * 3.0d0))) + (b ** 4.0d0)) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -2.6e+76) || !(a <= 8e+39)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = ((4.0 * ((a * a) + ((b * b) * 3.0))) + Math.pow(b, 4.0)) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -2.6e+76) or not (a <= 8e+39): tmp = math.pow(a, 4.0) else: tmp = ((4.0 * ((a * a) + ((b * b) * 3.0))) + math.pow(b, 4.0)) + -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -2.6e+76) || !(a <= 8e+39)) tmp = a ^ 4.0; else tmp = Float64(Float64(Float64(4.0 * Float64(Float64(a * a) + Float64(Float64(b * b) * 3.0))) + (b ^ 4.0)) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -2.6e+76) || ~((a <= 8e+39))) tmp = a ^ 4.0; else tmp = ((4.0 * ((a * a) + ((b * b) * 3.0))) + (b ^ 4.0)) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -2.6e+76], N[Not[LessEqual[a, 8e+39]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], N[(N[(N[(4.0 * N[(N[(a * a), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.6 \cdot 10^{+76} \lor \neg \left(a \leq 8 \cdot 10^{+39}\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;\left(4 \cdot \left(a \cdot a + \left(b \cdot b\right) \cdot 3\right) + {b}^{4}\right) + -1\\
\end{array}
\end{array}
if a < -2.5999999999999999e76 or 7.99999999999999952e39 < a Initial program 44.8%
associate--l+44.8%
fma-define44.9%
distribute-rgt-in44.9%
sqr-neg44.9%
distribute-rgt-in44.9%
Simplified45.9%
Taylor expanded in a around inf 97.6%
if -2.5999999999999999e76 < a < 7.99999999999999952e39Initial program 95.4%
Taylor expanded in a around 0 95.4%
fma-define95.4%
add-sqr-sqrt95.4%
fma-define95.4%
+-commutative95.4%
hypot-undefine95.4%
fma-define95.4%
+-commutative95.4%
hypot-undefine95.4%
unpow-prod-down95.4%
Applied egg-rr95.4%
pow-sqr95.5%
metadata-eval95.5%
Simplified95.5%
Taylor expanded in a around 0 99.9%
Taylor expanded in b around inf 94.3%
Final simplification95.6%
(FPCore (a b) :precision binary64 (if (or (<= a -2.2e+76) (not (<= a 8e+38))) (pow a 4.0) (+ (pow b 4.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((a <= -2.2e+76) || !(a <= 8e+38)) {
tmp = pow(a, 4.0);
} else {
tmp = pow(b, 4.0) + -1.0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-2.2d+76)) .or. (.not. (a <= 8d+38))) then
tmp = a ** 4.0d0
else
tmp = (b ** 4.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -2.2e+76) || !(a <= 8e+38)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = Math.pow(b, 4.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -2.2e+76) or not (a <= 8e+38): tmp = math.pow(a, 4.0) else: tmp = math.pow(b, 4.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -2.2e+76) || !(a <= 8e+38)) tmp = a ^ 4.0; else tmp = Float64((b ^ 4.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -2.2e+76) || ~((a <= 8e+38))) tmp = a ^ 4.0; else tmp = (b ^ 4.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -2.2e+76], N[Not[LessEqual[a, 8e+38]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.2 \cdot 10^{+76} \lor \neg \left(a \leq 8 \cdot 10^{+38}\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4} + -1\\
\end{array}
\end{array}
if a < -2.2e76 or 7.99999999999999982e38 < a Initial program 45.9%
associate--l+45.9%
fma-define45.9%
distribute-rgt-in45.9%
sqr-neg45.9%
distribute-rgt-in45.9%
Simplified46.9%
Taylor expanded in a around inf 96.7%
if -2.2e76 < a < 7.99999999999999982e38Initial program 95.3%
Taylor expanded in a around 0 95.3%
Taylor expanded in b around inf 93.2%
Final simplification94.6%
(FPCore (a b) :precision binary64 (if (or (<= a -0.0125) (not (<= a 0.0029))) (pow a 4.0) (+ (* 4.0 (* a a)) -1.0)))
double code(double a, double b) {
double tmp;
if ((a <= -0.0125) || !(a <= 0.0029)) {
tmp = pow(a, 4.0);
} else {
tmp = (4.0 * (a * a)) + -1.0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-0.0125d0)) .or. (.not. (a <= 0.0029d0))) then
tmp = a ** 4.0d0
else
tmp = (4.0d0 * (a * a)) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -0.0125) || !(a <= 0.0029)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = (4.0 * (a * a)) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -0.0125) or not (a <= 0.0029): tmp = math.pow(a, 4.0) else: tmp = (4.0 * (a * a)) + -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -0.0125) || !(a <= 0.0029)) tmp = a ^ 4.0; else tmp = Float64(Float64(4.0 * Float64(a * a)) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -0.0125) || ~((a <= 0.0029))) tmp = a ^ 4.0; else tmp = (4.0 * (a * a)) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -0.0125], N[Not[LessEqual[a, 0.0029]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], N[(N[(4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.0125 \lor \neg \left(a \leq 0.0029\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \left(a \cdot a\right) + -1\\
\end{array}
\end{array}
if a < -0.012500000000000001 or 0.0029 < a Initial program 52.6%
associate--l+52.6%
fma-define52.6%
distribute-rgt-in52.6%
sqr-neg52.6%
distribute-rgt-in52.6%
Simplified53.4%
Taylor expanded in a around inf 81.4%
if -0.012500000000000001 < a < 0.0029Initial program 99.9%
Taylor expanded in a around 0 99.9%
Taylor expanded in b around inf 80.3%
Taylor expanded in b around 0 46.1%
pow246.1%
Applied egg-rr46.1%
Final simplification63.9%
(FPCore (a b) :precision binary64 (if (<= b 0.036) (+ (* 4.0 (* a a)) -1.0) (if (<= b 8.8e+29) (pow a 4.0) (pow b 4.0))))
double code(double a, double b) {
double tmp;
if (b <= 0.036) {
tmp = (4.0 * (a * a)) + -1.0;
} else if (b <= 8.8e+29) {
tmp = pow(a, 4.0);
} else {
tmp = pow(b, 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= 0.036d0) then
tmp = (4.0d0 * (a * a)) + (-1.0d0)
else if (b <= 8.8d+29) then
tmp = a ** 4.0d0
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 0.036) {
tmp = (4.0 * (a * a)) + -1.0;
} else if (b <= 8.8e+29) {
tmp = Math.pow(a, 4.0);
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 0.036: tmp = (4.0 * (a * a)) + -1.0 elif b <= 8.8e+29: tmp = math.pow(a, 4.0) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 0.036) tmp = Float64(Float64(4.0 * Float64(a * a)) + -1.0); elseif (b <= 8.8e+29) tmp = a ^ 4.0; else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 0.036) tmp = (4.0 * (a * a)) + -1.0; elseif (b <= 8.8e+29) tmp = a ^ 4.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 0.036], N[(N[(4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[b, 8.8e+29], N[Power[a, 4.0], $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.036:\\
\;\;\;\;4 \cdot \left(a \cdot a\right) + -1\\
\mathbf{elif}\;b \leq 8.8 \cdot 10^{+29}:\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 0.0359999999999999973Initial program 79.5%
Taylor expanded in a around 0 94.7%
Taylor expanded in b around inf 54.8%
Taylor expanded in b around 0 56.5%
pow256.5%
Applied egg-rr56.5%
if 0.0359999999999999973 < b < 8.8000000000000005e29Initial program 55.2%
associate--l+55.2%
fma-define55.2%
distribute-rgt-in55.2%
sqr-neg55.2%
distribute-rgt-in55.2%
Simplified55.2%
Taylor expanded in a around inf 57.6%
if 8.8000000000000005e29 < b Initial program 67.6%
associate--l+67.6%
fma-define67.7%
distribute-rgt-in67.7%
sqr-neg67.7%
distribute-rgt-in67.7%
Simplified67.7%
Taylor expanded in b around inf 88.4%
Final simplification63.5%
(FPCore (a b) :precision binary64 (+ (* 4.0 (* a a)) -1.0))
double code(double a, double b) {
return (4.0 * (a * a)) + -1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (4.0d0 * (a * a)) + (-1.0d0)
end function
public static double code(double a, double b) {
return (4.0 * (a * a)) + -1.0;
}
def code(a, b): return (4.0 * (a * a)) + -1.0
function code(a, b) return Float64(Float64(4.0 * Float64(a * a)) + -1.0) end
function tmp = code(a, b) tmp = (4.0 * (a * a)) + -1.0; end
code[a_, b_] := N[(N[(4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
4 \cdot \left(a \cdot a\right) + -1
\end{array}
Initial program 76.0%
Taylor expanded in a around 0 91.3%
Taylor expanded in b around inf 59.4%
Taylor expanded in b around 0 48.9%
pow248.9%
Applied egg-rr48.9%
Final simplification48.9%
(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%
associate--l+76.0%
fma-define76.0%
distribute-rgt-in76.0%
sqr-neg76.0%
distribute-rgt-in76.0%
Simplified76.4%
Taylor expanded in a around inf 83.8%
mul-1-neg83.8%
cube-neg83.8%
Simplified83.8%
Taylor expanded in a around 0 72.7%
associate-+r-72.7%
fma-define72.7%
unpow272.7%
unpow272.7%
swap-sqr78.1%
unpow278.1%
*-commutative78.1%
sub-neg78.1%
metadata-eval78.1%
Simplified78.1%
Taylor expanded in b around 0 23.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))