
(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 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) (- 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 (if (<= (* b b) 5e+150) (+ (+ (pow (+ (* b b) (* a a)) 2.0) (* 4.0 (* b (* b (* a -3.0))))) -1.0) (+ (* (* b b) (+ (* b b) 4.0)) -1.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 5e+150) {
tmp = (pow(((b * b) + (a * a)), 2.0) + (4.0 * (b * (b * (a * -3.0))))) + -1.0;
} else {
tmp = ((b * b) * ((b * 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+150) then
tmp = ((((b * b) + (a * a)) ** 2.0d0) + (4.0d0 * (b * (b * (a * (-3.0d0)))))) + (-1.0d0)
else
tmp = ((b * b) * ((b * 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+150) {
tmp = (Math.pow(((b * b) + (a * a)), 2.0) + (4.0 * (b * (b * (a * -3.0))))) + -1.0;
} else {
tmp = ((b * b) * ((b * b) + 4.0)) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 5e+150: tmp = (math.pow(((b * b) + (a * a)), 2.0) + (4.0 * (b * (b * (a * -3.0))))) + -1.0 else: tmp = ((b * b) * ((b * b) + 4.0)) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 5e+150) tmp = Float64(Float64((Float64(Float64(b * b) + Float64(a * a)) ^ 2.0) + Float64(4.0 * Float64(b * Float64(b * Float64(a * -3.0))))) + -1.0); else tmp = Float64(Float64(Float64(b * b) * Float64(Float64(b * b) + 4.0)) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 5e+150) tmp = ((((b * b) + (a * a)) ^ 2.0) + (4.0 * (b * (b * (a * -3.0))))) + -1.0; else tmp = ((b * b) * ((b * b) + 4.0)) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 5e+150], N[(N[(N[Power[N[(N[(b * b), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(b * N[(b * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 5 \cdot 10^{+150}:\\
\;\;\;\;\left({\left(b \cdot b + a \cdot a\right)}^{2} + 4 \cdot \left(b \cdot \left(b \cdot \left(a \cdot -3\right)\right)\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(b \cdot b + 4\right) + -1\\
\end{array}
\end{array}
if (*.f64 b b) < 5.00000000000000009e150Initial program 82.9%
Taylor expanded in a around inf 82.4%
*-commutative82.4%
*-commutative82.4%
unpow282.4%
Simplified82.4%
Taylor expanded in a around 0 98.5%
*-commutative98.5%
unpow298.5%
*-commutative98.5%
associate-*r*98.5%
associate-*l*98.5%
Simplified98.5%
if 5.00000000000000009e150 < (*.f64 b b) Initial program 62.9%
Taylor expanded in a around 0 61.9%
associate-+r+61.9%
+-commutative61.9%
associate-*r*61.9%
distribute-rgt-out82.5%
unpow282.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in a around 0 100.0%
metadata-eval100.0%
pow-sqr100.0%
pow2100.0%
pow2100.0%
distribute-lft-out100.0%
Applied egg-rr100.0%
Final simplification99.1%
(FPCore (a b) :precision binary64 (if (<= a -2.4e+31) (pow a 4.0) (if (<= a 4.5e+38) (+ (+ (pow b 4.0) (* (* b b) 4.0)) -1.0) (pow a 4.0))))
double code(double a, double b) {
double tmp;
if (a <= -2.4e+31) {
tmp = pow(a, 4.0);
} else if (a <= 4.5e+38) {
tmp = (pow(b, 4.0) + ((b * b) * 4.0)) + -1.0;
} else {
tmp = pow(a, 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-2.4d+31)) then
tmp = a ** 4.0d0
else if (a <= 4.5d+38) then
tmp = ((b ** 4.0d0) + ((b * b) * 4.0d0)) + (-1.0d0)
else
tmp = a ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -2.4e+31) {
tmp = Math.pow(a, 4.0);
} else if (a <= 4.5e+38) {
tmp = (Math.pow(b, 4.0) + ((b * b) * 4.0)) + -1.0;
} else {
tmp = Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -2.4e+31: tmp = math.pow(a, 4.0) elif a <= 4.5e+38: tmp = (math.pow(b, 4.0) + ((b * b) * 4.0)) + -1.0 else: tmp = math.pow(a, 4.0) return tmp
function code(a, b) tmp = 0.0 if (a <= -2.4e+31) tmp = a ^ 4.0; elseif (a <= 4.5e+38) tmp = Float64(Float64((b ^ 4.0) + Float64(Float64(b * b) * 4.0)) + -1.0); else tmp = a ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2.4e+31) tmp = a ^ 4.0; elseif (a <= 4.5e+38) tmp = ((b ^ 4.0) + ((b * b) * 4.0)) + -1.0; else tmp = a ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -2.4e+31], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 4.5e+38], N[(N[(N[Power[b, 4.0], $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[Power[a, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{+31}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 4.5 \cdot 10^{+38}:\\
\;\;\;\;\left({b}^{4} + \left(b \cdot b\right) \cdot 4\right) + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\end{array}
\end{array}
if a < -2.39999999999999982e31 or 4.4999999999999998e38 < a Initial program 43.7%
associate--l+43.7%
sqr-pow43.7%
sqr-pow43.7%
fma-def43.7%
fma-neg43.7%
Simplified47.5%
Taylor expanded in a around inf 96.6%
if -2.39999999999999982e31 < a < 4.4999999999999998e38Initial program 97.2%
Taylor expanded in a around 0 82.8%
associate-+r+82.8%
+-commutative82.8%
associate-*r*82.8%
distribute-rgt-out96.0%
unpow296.0%
+-commutative96.0%
Simplified96.0%
Taylor expanded in a around 0 98.7%
Final simplification97.8%
(FPCore (a b) :precision binary64 (if (<= a -8e+25) (pow a 4.0) (if (<= a 1.5e+39) (+ (* b (* b (fma b b 4.0))) -1.0) (pow a 4.0))))
double code(double a, double b) {
double tmp;
if (a <= -8e+25) {
tmp = pow(a, 4.0);
} else if (a <= 1.5e+39) {
tmp = (b * (b * fma(b, b, 4.0))) + -1.0;
} else {
tmp = pow(a, 4.0);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (a <= -8e+25) tmp = a ^ 4.0; elseif (a <= 1.5e+39) tmp = Float64(Float64(b * Float64(b * fma(b, b, 4.0))) + -1.0); else tmp = a ^ 4.0; end return tmp end
code[a_, b_] := If[LessEqual[a, -8e+25], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 1.5e+39], N[(N[(b * N[(b * N[(b * b + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[Power[a, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8 \cdot 10^{+25}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 1.5 \cdot 10^{+39}:\\
\;\;\;\;b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 4\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\end{array}
\end{array}
if a < -8.00000000000000072e25 or 1.5e39 < a Initial program 43.7%
associate--l+43.7%
sqr-pow43.7%
sqr-pow43.7%
fma-def43.7%
fma-neg43.7%
Simplified47.5%
Taylor expanded in a around inf 96.6%
if -8.00000000000000072e25 < a < 1.5e39Initial program 97.2%
Taylor expanded in a around 0 82.8%
associate-+r+82.8%
+-commutative82.8%
associate-*r*82.8%
distribute-rgt-out96.0%
unpow296.0%
+-commutative96.0%
Simplified96.0%
Taylor expanded in a around 0 98.7%
Taylor expanded in b around 0 98.7%
unpow298.7%
metadata-eval98.7%
pow-sqr98.6%
unpow298.6%
unpow298.6%
distribute-rgt-in98.6%
associate-*l*98.6%
+-commutative98.6%
fma-def98.6%
Simplified98.6%
Final simplification97.8%
(FPCore (a b) :precision binary64 (if (<= a -56000000000.0) (pow a 4.0) (if (<= a 2.15e+40) (+ (* (* b b) (+ (* b b) 4.0)) -1.0) (pow a 4.0))))
double code(double a, double b) {
double tmp;
if (a <= -56000000000.0) {
tmp = pow(a, 4.0);
} else if (a <= 2.15e+40) {
tmp = ((b * b) * ((b * b) + 4.0)) + -1.0;
} else {
tmp = pow(a, 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-56000000000.0d0)) then
tmp = a ** 4.0d0
else if (a <= 2.15d+40) then
tmp = ((b * b) * ((b * b) + 4.0d0)) + (-1.0d0)
else
tmp = a ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -56000000000.0) {
tmp = Math.pow(a, 4.0);
} else if (a <= 2.15e+40) {
tmp = ((b * b) * ((b * b) + 4.0)) + -1.0;
} else {
tmp = Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -56000000000.0: tmp = math.pow(a, 4.0) elif a <= 2.15e+40: tmp = ((b * b) * ((b * b) + 4.0)) + -1.0 else: tmp = math.pow(a, 4.0) return tmp
function code(a, b) tmp = 0.0 if (a <= -56000000000.0) tmp = a ^ 4.0; elseif (a <= 2.15e+40) tmp = Float64(Float64(Float64(b * b) * Float64(Float64(b * b) + 4.0)) + -1.0); else tmp = a ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -56000000000.0) tmp = a ^ 4.0; elseif (a <= 2.15e+40) tmp = ((b * b) * ((b * b) + 4.0)) + -1.0; else tmp = a ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -56000000000.0], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 2.15e+40], N[(N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[Power[a, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -56000000000:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 2.15 \cdot 10^{+40}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(b \cdot b + 4\right) + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\end{array}
\end{array}
if a < -5.6e10 or 2.1500000000000001e40 < a Initial program 43.7%
associate--l+43.7%
sqr-pow43.7%
sqr-pow43.7%
fma-def43.7%
fma-neg43.7%
Simplified47.5%
Taylor expanded in a around inf 96.6%
if -5.6e10 < a < 2.1500000000000001e40Initial program 97.2%
Taylor expanded in a around 0 82.8%
associate-+r+82.8%
+-commutative82.8%
associate-*r*82.8%
distribute-rgt-out96.0%
unpow296.0%
+-commutative96.0%
Simplified96.0%
Taylor expanded in a around 0 98.7%
metadata-eval98.7%
pow-sqr98.6%
pow298.6%
pow298.6%
distribute-lft-out98.6%
Applied egg-rr98.6%
Final simplification97.7%
(FPCore (a b) :precision binary64 (if (<= a -5000000000.0) (+ (* -12.0 (* (* b b) a)) -1.0) (+ (* b (* b 4.0)) -1.0)))
double code(double a, double b) {
double tmp;
if (a <= -5000000000.0) {
tmp = (-12.0 * ((b * b) * a)) + -1.0;
} else {
tmp = (b * (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 <= (-5000000000.0d0)) then
tmp = ((-12.0d0) * ((b * b) * a)) + (-1.0d0)
else
tmp = (b * (b * 4.0d0)) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -5000000000.0) {
tmp = (-12.0 * ((b * b) * a)) + -1.0;
} else {
tmp = (b * (b * 4.0)) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -5000000000.0: tmp = (-12.0 * ((b * b) * a)) + -1.0 else: tmp = (b * (b * 4.0)) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (a <= -5000000000.0) tmp = Float64(Float64(-12.0 * Float64(Float64(b * b) * a)) + -1.0); else tmp = Float64(Float64(b * Float64(b * 4.0)) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -5000000000.0) tmp = (-12.0 * ((b * b) * a)) + -1.0; else tmp = (b * (b * 4.0)) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -5000000000.0], N[(N[(-12.0 * N[(N[(b * b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(b * N[(b * 4.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5000000000:\\
\;\;\;\;-12 \cdot \left(\left(b \cdot b\right) \cdot a\right) + -1\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(b \cdot 4\right) + -1\\
\end{array}
\end{array}
if a < -5e9Initial program 23.6%
Taylor expanded in a around 0 47.2%
associate-+r+47.2%
+-commutative47.2%
associate-*r*47.2%
distribute-rgt-out47.2%
unpow247.2%
+-commutative47.2%
Simplified47.2%
Taylor expanded in a around inf 42.5%
unpow242.5%
Simplified42.5%
if -5e9 < a Initial program 90.8%
Taylor expanded in a around 0 63.5%
associate-+r+63.5%
+-commutative63.5%
associate-*r*63.5%
distribute-rgt-out73.7%
unpow273.7%
+-commutative73.7%
Simplified73.7%
Taylor expanded in a around 0 82.5%
Taylor expanded in b around 0 82.5%
unpow282.5%
metadata-eval82.5%
pow-sqr82.4%
unpow282.4%
unpow282.4%
distribute-rgt-in82.4%
associate-*l*82.4%
+-commutative82.4%
fma-def82.4%
Simplified82.4%
Taylor expanded in b around 0 59.8%
unpow259.8%
*-commutative59.8%
associate-*r*59.8%
Simplified59.8%
Final simplification55.8%
(FPCore (a b) :precision binary64 (+ (* (* b b) (+ (* b b) 4.0)) -1.0))
double code(double a, double b) {
return ((b * b) * ((b * b) + 4.0)) + -1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((b * b) * ((b * b) + 4.0d0)) + (-1.0d0)
end function
public static double code(double a, double b) {
return ((b * b) * ((b * b) + 4.0)) + -1.0;
}
def code(a, b): return ((b * b) * ((b * b) + 4.0)) + -1.0
function code(a, b) return Float64(Float64(Float64(b * b) * Float64(Float64(b * b) + 4.0)) + -1.0) end
function tmp = code(a, b) tmp = ((b * b) * ((b * b) + 4.0)) + -1.0; end
code[a_, b_] := N[(N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
\left(b \cdot b\right) \cdot \left(b \cdot b + 4\right) + -1
\end{array}
Initial program 75.3%
Taylor expanded in a around 0 59.8%
associate-+r+59.8%
+-commutative59.8%
associate-*r*59.8%
distribute-rgt-out67.6%
unpow267.6%
+-commutative67.6%
Simplified67.6%
Taylor expanded in a around 0 73.5%
metadata-eval73.5%
pow-sqr73.4%
pow273.4%
pow273.4%
distribute-lft-out73.4%
Applied egg-rr73.4%
Final simplification73.4%
(FPCore (a b) :precision binary64 (+ (* b (* b 4.0)) -1.0))
double code(double a, double b) {
return (b * (b * 4.0)) + -1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (b * (b * 4.0d0)) + (-1.0d0)
end function
public static double code(double a, double b) {
return (b * (b * 4.0)) + -1.0;
}
def code(a, b): return (b * (b * 4.0)) + -1.0
function code(a, b) return Float64(Float64(b * Float64(b * 4.0)) + -1.0) end
function tmp = code(a, b) tmp = (b * (b * 4.0)) + -1.0; end
code[a_, b_] := N[(N[(b * N[(b * 4.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
b \cdot \left(b \cdot 4\right) + -1
\end{array}
Initial program 75.3%
Taylor expanded in a around 0 59.8%
associate-+r+59.8%
+-commutative59.8%
associate-*r*59.8%
distribute-rgt-out67.6%
unpow267.6%
+-commutative67.6%
Simplified67.6%
Taylor expanded in a around 0 73.5%
Taylor expanded in b around 0 73.5%
unpow273.5%
metadata-eval73.5%
pow-sqr73.4%
unpow273.4%
unpow273.4%
distribute-rgt-in73.4%
associate-*l*73.5%
+-commutative73.5%
fma-def73.5%
Simplified73.5%
Taylor expanded in b around 0 51.6%
unpow251.6%
*-commutative51.6%
associate-*r*51.6%
Simplified51.6%
Final simplification51.6%
(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 75.3%
Taylor expanded in a around 0 59.8%
associate-+r+59.8%
+-commutative59.8%
associate-*r*59.8%
distribute-rgt-out67.6%
unpow267.6%
+-commutative67.6%
Simplified67.6%
Taylor expanded in b around 0 27.5%
Final simplification27.5%
herbie shell --seed 2023285
(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))