
(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 7 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
(if (<= (* b b) 1e+117)
(+
(+ (pow (+ (* b b) (* a a)) 2.0) (* 4.0 (+ (* a a) (* (* b b) (+ a 3.0)))))
-1.0)
(pow b 4.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 1e+117) {
tmp = (pow(((b * b) + (a * a)), 2.0) + (4.0 * ((a * a) + ((b * b) * (a + 3.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) <= 1d+117) then
tmp = ((((b * b) + (a * a)) ** 2.0d0) + (4.0d0 * ((a * a) + ((b * b) * (a + 3.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) <= 1e+117) {
tmp = (Math.pow(((b * b) + (a * a)), 2.0) + (4.0 * ((a * a) + ((b * b) * (a + 3.0))))) + -1.0;
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 1e+117: tmp = (math.pow(((b * b) + (a * a)), 2.0) + (4.0 * ((a * a) + ((b * b) * (a + 3.0))))) + -1.0 else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 1e+117) tmp = Float64(Float64((Float64(Float64(b * b) + Float64(a * a)) ^ 2.0) + Float64(4.0 * Float64(Float64(a * a) + Float64(Float64(b * b) * Float64(a + 3.0))))) + -1.0); else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 1e+117) tmp = ((((b * b) + (a * a)) ^ 2.0) + (4.0 * ((a * a) + ((b * b) * (a + 3.0))))) + -1.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 1e+117], N[(N[(N[Power[N[(N[(b * b), $MachinePrecision] + N[(a * a), $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[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 10^{+117}:\\
\;\;\;\;\left({\left(b \cdot b + a \cdot a\right)}^{2} + 4 \cdot \left(a \cdot a + \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if (*.f64 b b) < 1.00000000000000005e117Initial program 80.6%
Taylor expanded in a around 0 98.4%
if 1.00000000000000005e117 < (*.f64 b b) Initial program 67.7%
associate--l+67.7%
fma-define67.7%
distribute-rgt-in67.7%
sqr-neg67.7%
distribute-rgt-in67.7%
Simplified69.8%
Taylor expanded in a around 0 100.0%
Taylor expanded in b around inf 100.0%
Final simplification99.0%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2.5e+93) (+ (* (* a a) (+ 4.0 (* a (- a 4.0)))) -1.0) (pow b 4.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2.5e+93) {
tmp = ((a * a) * (4.0 + (a * (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) <= 2.5d+93) then
tmp = ((a * a) * (4.0d0 + (a * (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) <= 2.5e+93) {
tmp = ((a * a) * (4.0 + (a * (a - 4.0)))) + -1.0;
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2.5e+93: tmp = ((a * a) * (4.0 + (a * (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) <= 2.5e+93) tmp = Float64(Float64(Float64(a * a) * Float64(4.0 + Float64(a * 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) <= 2.5e+93) tmp = ((a * a) * (4.0 + (a * (a - 4.0)))) + -1.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2.5e+93], N[(N[(N[(a * a), $MachinePrecision] * N[(4.0 + N[(a * N[(a - 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2.5 \cdot 10^{+93}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(4 + a \cdot \left(a - 4\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if (*.f64 b b) < 2.5000000000000001e93Initial program 81.6%
associate--l+81.6%
fma-define81.6%
distribute-rgt-in81.6%
sqr-neg81.6%
distribute-rgt-in81.6%
Simplified81.6%
Taylor expanded in b around 0 78.8%
Taylor expanded in a around 0 97.1%
pow297.1%
Applied egg-rr97.1%
if 2.5000000000000001e93 < (*.f64 b b) Initial program 67.0%
associate--l+67.0%
fma-define67.0%
distribute-rgt-in67.0%
sqr-neg67.0%
distribute-rgt-in67.0%
Simplified68.9%
Taylor expanded in a around 0 97.3%
Taylor expanded in b around inf 97.3%
Final simplification97.2%
(FPCore (a b) :precision binary64 (if (<= (* b b) 1.5e+307) (+ (* (* a a) (+ 4.0 (* a (- a 4.0)))) -1.0) (+ (* (* b b) 12.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 1.5e+307) {
tmp = ((a * a) * (4.0 + (a * (a - 4.0)))) + -1.0;
} else {
tmp = ((b * b) * 12.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) <= 1.5d+307) then
tmp = ((a * a) * (4.0d0 + (a * (a - 4.0d0)))) + (-1.0d0)
else
tmp = ((b * b) * 12.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 1.5e+307) {
tmp = ((a * a) * (4.0 + (a * (a - 4.0)))) + -1.0;
} else {
tmp = ((b * b) * 12.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 1.5e+307: tmp = ((a * a) * (4.0 + (a * (a - 4.0)))) + -1.0 else: tmp = ((b * b) * 12.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 1.5e+307) tmp = Float64(Float64(Float64(a * a) * Float64(4.0 + Float64(a * Float64(a - 4.0)))) + -1.0); else tmp = Float64(Float64(Float64(b * b) * 12.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 1.5e+307) tmp = ((a * a) * (4.0 + (a * (a - 4.0)))) + -1.0; else tmp = ((b * b) * 12.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 1.5e+307], N[(N[(N[(a * a), $MachinePrecision] * N[(4.0 + N[(a * N[(a - 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 1.5 \cdot 10^{+307}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(4 + a \cdot \left(a - 4\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot 12 + -1\\
\end{array}
\end{array}
if (*.f64 b b) < 1.4999999999999999e307Initial program 80.8%
associate--l+80.8%
fma-define80.8%
distribute-rgt-in80.8%
sqr-neg80.8%
distribute-rgt-in80.8%
Simplified81.3%
Taylor expanded in b around 0 65.7%
Taylor expanded in a around 0 82.3%
pow282.3%
Applied egg-rr82.3%
if 1.4999999999999999e307 < (*.f64 b b) Initial program 58.6%
associate--l+58.6%
fma-define58.6%
distribute-rgt-in58.6%
sqr-neg58.6%
distribute-rgt-in58.6%
Simplified60.3%
Taylor expanded in a around 0 100.0%
Taylor expanded in b around 0 100.0%
pow2100.0%
Applied egg-rr100.0%
Final simplification86.3%
(FPCore (a b) :precision binary64 (if (<= a -6.3e+66) (+ (* (* a a) (+ 4.0 (* a -4.0))) -1.0) (if (<= a 1e+118) (+ (* (* b b) 12.0) -1.0) (+ (* (* a a) 4.0) -1.0))))
double code(double a, double b) {
double tmp;
if (a <= -6.3e+66) {
tmp = ((a * a) * (4.0 + (a * -4.0))) + -1.0;
} else if (a <= 1e+118) {
tmp = ((b * b) * 12.0) + -1.0;
} else {
tmp = ((a * a) * 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 <= (-6.3d+66)) then
tmp = ((a * a) * (4.0d0 + (a * (-4.0d0)))) + (-1.0d0)
else if (a <= 1d+118) then
tmp = ((b * b) * 12.0d0) + (-1.0d0)
else
tmp = ((a * a) * 4.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -6.3e+66) {
tmp = ((a * a) * (4.0 + (a * -4.0))) + -1.0;
} else if (a <= 1e+118) {
tmp = ((b * b) * 12.0) + -1.0;
} else {
tmp = ((a * a) * 4.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -6.3e+66: tmp = ((a * a) * (4.0 + (a * -4.0))) + -1.0 elif a <= 1e+118: tmp = ((b * b) * 12.0) + -1.0 else: tmp = ((a * a) * 4.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (a <= -6.3e+66) tmp = Float64(Float64(Float64(a * a) * Float64(4.0 + Float64(a * -4.0))) + -1.0); elseif (a <= 1e+118) tmp = Float64(Float64(Float64(b * b) * 12.0) + -1.0); else tmp = Float64(Float64(Float64(a * a) * 4.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -6.3e+66) tmp = ((a * a) * (4.0 + (a * -4.0))) + -1.0; elseif (a <= 1e+118) tmp = ((b * b) * 12.0) + -1.0; else tmp = ((a * a) * 4.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -6.3e+66], N[(N[(N[(a * a), $MachinePrecision] * N[(4.0 + N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[a, 1e+118], N[(N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision] + -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.3 \cdot 10^{+66}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(4 + a \cdot -4\right) + -1\\
\mathbf{elif}\;a \leq 10^{+118}:\\
\;\;\;\;\left(b \cdot b\right) \cdot 12 + -1\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot 4 + -1\\
\end{array}
\end{array}
if a < -6.2999999999999998e66Initial program 63.0%
associate--l+63.0%
fma-define63.0%
distribute-rgt-in63.0%
sqr-neg63.0%
distribute-rgt-in63.0%
Simplified63.0%
Taylor expanded in b around 0 100.0%
Taylor expanded in a around 0 94.0%
*-commutative94.0%
Simplified94.0%
pow2100.0%
Applied egg-rr94.0%
if -6.2999999999999998e66 < a < 9.99999999999999967e117Initial program 94.8%
associate--l+94.8%
fma-define94.8%
distribute-rgt-in94.8%
sqr-neg94.8%
distribute-rgt-in94.8%
Simplified95.3%
Taylor expanded in a around 0 92.1%
Taylor expanded in b around 0 72.3%
pow272.3%
Applied egg-rr72.3%
if 9.99999999999999967e117 < a Initial program 0.0%
associate--l+0.0%
fma-define0.0%
distribute-rgt-in0.0%
sqr-neg0.0%
distribute-rgt-in0.0%
Simplified2.8%
Taylor expanded in b around 0 0.0%
Taylor expanded in a around 0 0.0%
*-commutative0.0%
Simplified0.0%
pow2100.0%
Applied egg-rr0.0%
Taylor expanded in a around 0 87.3%
Final simplification78.3%
(FPCore (a b) :precision binary64 (if (<= (* b b) 6.7e+304) (+ (* (* a a) 4.0) -1.0) (+ (* (* b b) 12.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 6.7e+304) {
tmp = ((a * a) * 4.0) + -1.0;
} else {
tmp = ((b * b) * 12.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) <= 6.7d+304) then
tmp = ((a * a) * 4.0d0) + (-1.0d0)
else
tmp = ((b * b) * 12.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 6.7e+304) {
tmp = ((a * a) * 4.0) + -1.0;
} else {
tmp = ((b * b) * 12.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 6.7e+304: tmp = ((a * a) * 4.0) + -1.0 else: tmp = ((b * b) * 12.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 6.7e+304) tmp = Float64(Float64(Float64(a * a) * 4.0) + -1.0); else tmp = Float64(Float64(Float64(b * b) * 12.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 6.7e+304) tmp = ((a * a) * 4.0) + -1.0; else tmp = ((b * b) * 12.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 6.7e+304], N[(N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 6.7 \cdot 10^{+304}:\\
\;\;\;\;\left(a \cdot a\right) \cdot 4 + -1\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot 12 + -1\\
\end{array}
\end{array}
if (*.f64 b b) < 6.6999999999999998e304Initial program 80.8%
associate--l+80.8%
fma-define80.8%
distribute-rgt-in80.8%
sqr-neg80.8%
distribute-rgt-in80.8%
Simplified81.3%
Taylor expanded in b around 0 65.7%
Taylor expanded in a around 0 57.9%
*-commutative57.9%
Simplified57.9%
pow282.3%
Applied egg-rr57.9%
Taylor expanded in a around 0 66.5%
if 6.6999999999999998e304 < (*.f64 b b) Initial program 58.6%
associate--l+58.6%
fma-define58.6%
distribute-rgt-in58.6%
sqr-neg58.6%
distribute-rgt-in58.6%
Simplified60.3%
Taylor expanded in a around 0 100.0%
Taylor expanded in b around 0 100.0%
pow2100.0%
Applied egg-rr100.0%
Final simplification74.1%
(FPCore (a b) :precision binary64 (+ (* (* b b) 12.0) -1.0))
double code(double a, double b) {
return ((b * b) * 12.0) + -1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((b * b) * 12.0d0) + (-1.0d0)
end function
public static double code(double a, double b) {
return ((b * b) * 12.0) + -1.0;
}
def code(a, b): return ((b * b) * 12.0) + -1.0
function code(a, b) return Float64(Float64(Float64(b * b) * 12.0) + -1.0) end
function tmp = code(a, b) tmp = ((b * b) * 12.0) + -1.0; end
code[a_, b_] := N[(N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
\left(b \cdot b\right) \cdot 12 + -1
\end{array}
Initial program 75.7%
associate--l+75.7%
fma-define75.7%
distribute-rgt-in75.7%
sqr-neg75.7%
distribute-rgt-in75.7%
Simplified76.5%
Taylor expanded in a around 0 73.0%
Taylor expanded in b around 0 56.2%
pow256.2%
Applied egg-rr56.2%
Final simplification56.2%
(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.7%
associate--l+75.7%
fma-define75.7%
distribute-rgt-in75.7%
sqr-neg75.7%
distribute-rgt-in75.7%
Simplified76.5%
Taylor expanded in a around 0 73.0%
Taylor expanded in b around 0 32.3%
herbie shell --seed 2024191
(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))